Repository navigation
Conversation
New opt-in `ingress.cors` (enabled, allowMethods, allowHeaders, exposeHeaders) lets every application accept credentialed cross-origin requests from the deployment's own hosts (<domain> and *.<domain>). - nginx: enable-cors annotations on the application and use_services proxy ingresses. The nginx wildcard matches one label, so nested application hosts (e.g. instance.app.<domain>) are listed explicitly. - traefik: ch-cors headers middleware matching any subdomain depth, appended to the router middlewares. The ingress answers preflights and its headers replace those set by gatekeepers or applications for the allowed origins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
filippomc
force-pushed
the
feature/CH-155-CORS
branch
from
November 27, 2026 09:22
1cd8e01 to
65a1f99
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes CH-155
Implemented solution
Applications served on different subdomains of a deployment can now call each other with credentials (cookies,
Authorization) without going through theuse_services/proxy/<service>path. CORS is handled once at the ingress, for every application.New opt-in values. The default is off, so existing deployments render exactly as before:
The allowed origins are
<domain>and*.<domain>, overhttpswhentlsis set andhttpotherwise. Credentials are always allowed.ingress.yaml):enable-cors,cors-allow-origin,cors-allow-credentials,cors-allow-methods,cors-allow-headersand, when set,cors-expose-headersare added to both the application Ingress and theuse_services-proxyIngress.https://*.<domain>,https://<domain>rather than the bare*.<domain>sketched in the issue.instance.app.<domain>) are appended to the list one by one.traefik-middlewares.yaml): ach-corsheadersMiddleware withaccessControlAllowOriginListRegex: ^https://([A-Za-z0-9-]+\.)*<domain>$(any depth), appended torouter.middlewareson both Ingresses.For allowed origins the ingress answers the preflight requests itself, and its headers replace the ones set by gatekeepers or applications (ingress-nginx sets them with
more_set_headers). Requests from other origins get no CORS headers from the ingress, so an application's own CORS handling still applies to them. The gatekeepers' existingcors-origins: *.<domain>configuration is left as it is.Security note: when enabled, every
*.<domain>host is trusted by every application: a script on any subdomain page can read the authenticated responses of all of them. The new section indocs/ingress-domains-proxies.mdsays so, and advises against enabling it where a subdomain serves untrusted content (e.g. user notebooks).How to test this PR
pytest tools/deployment-cli-tools/tests/test_helm.py -k ingress_cors. It renders the chart withhelm templateand checks that:enabled: true, the nginx annotations are on both the application and the proxy Ingress, including a nested alias, for TLS and non-TLS;ingressClass: traefik, thech-corsMiddleware exists, is referenced by both Ingresses, and its regex accepts the domain and its subdomains while refusinghttp://origins and lookalike domains;ingress.cors.enabled: trueindeployment-configuration/values-template.yaml, runharness-deployment, thenhelm template deployment/helm. Every generated Ingress should carry thenginx.ingress.kubernetes.io/*cors*annotations (or referencech-corswith traefik).<app>any application subdomain:What has been verified so far: the
tools/deployment-cli-tools/testssuite passes locally (294 tests) and the lint check is clean. A downstream project's chart was generated and rendered for an nginx and a traefik environment: every generated Ingress got the CORS configuration, and the nginx values pass ingress-nginx's annotation validation patterns, which were reproduced from its source rather than run against the controller. Step 3 has not been run on a cluster yet.Sanity checks:
Breaking changes (select one):
breaking-changeand the migration procedure is well described abovePossible deployment updates issues (select one):
alert:deploymentTest coverage (select one):
Documentation (select one):
Nice to have (if relevant):
🤖 Generated with Claude Code