- Notifications
You must be signed in to change notification settings - Fork1k
Commitffbfaf2
authored
feat: allow bypassing current CORS magic based on template config (#18706)
Solves#15096This is a slight rework/refactor of the earlier PRs from@dannykoppingand@Emyrk:-#15669-#15684-#17596Rather than having a per-app CORS behaviour setting and additionally atemplate level setting for ports, this PR adds a single template levelCORS behaviour setting that is then used by all apps/ports forworkspaces created from that template.The main changes are in `proxy.go` and `request.go` to:a) get the CORS behaviour setting from the templateb) have `HandleSubdomain` bypass the CORS middleware handler if theselected behaviour is `passthru`c) in `proxyWorkspaceApp`, do not modify the response if the selectedbehaviour is `passthru`<!-- This is an auto-generated comment: release notes by coderabbit.ai-->## Summary by CodeRabbit* **New Features*** Added support for configuring CORS behavior ("simple" or "passthru")at the template level for all shared ports.* Introduced a new "CORS Behavior" setting in the template creation andsettings forms.* API endpoints and responses now include the optional `cors_behavior`property for templates.* Workspace apps and proxy now honor the specified CORS behavior,enabling conditional CORS middleware application.* Enhanced workspace app tests with comprehensive scenarios coveringCORS behaviors and authentication states.* **Bug Fixes** * None.* **Documentation*** Updated API and admin documentation to describe the new`cors_behavior` property and its usage.* Added examples and schema references for CORS behavior in relevant APIdocs.* **Tests*** Extended automated tests to cover different CORS behavior scenariosfor templates and workspace apps.* **Chores*** Updated audit logging to track changes to the `cors_behavior` field ontemplates.<!-- end of auto-generated comment: release notes by coderabbit.ai -->---------Signed-off-by: Callum Styan <callumstyan@gmail.com>1 parent96e32d6 commitffbfaf2
File tree
36 files changed
+1149
-108
lines changed- coderd
- apidoc
- database
- dbauthz
- dbgen
- migrations
- queries
- prometheusmetrics
- workspaceapps
- apptest
- cors
- codersdk
- docs
- admin/security
- reference/api
- enterprise
- audit
- wsproxy
- site
- e2e/tests/templates
- src
- api
- pages
- CreateTemplatePage
- TemplateSettingsPage/TemplateGeneralSettingsPage
- testHelpers
36 files changed
+1149
-108
lines changedSome generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1462 | 1462 |
| |
1463 | 1463 |
| |
1464 | 1464 |
| |
| 1465 | + | |
1465 | 1466 |
| |
1466 | 1467 |
| |
1467 | 1468 |
| |
| |||
1582 | 1583 |
| |
1583 | 1584 |
| |
1584 | 1585 |
| |
| 1586 | + | |
1585 | 1587 |
| |
1586 | 1588 |
| |
1587 | 1589 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
148 | 148 |
| |
149 | 149 |
| |
150 | 150 |
| |
| 151 | + | |
151 | 152 |
| |
152 | 153 |
| |
153 | 154 |
| |
|
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 46 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + |
Lines changed: 52 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
120 | 120 |
| |
121 | 121 |
| |
122 | 122 |
| |
| 123 | + | |
123 | 124 |
| |
124 | 125 |
| |
125 | 126 |
| |
|
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
0 commit comments
Comments
(0)