fix(codespaces): fix reverse proxy warning and enable CSP#2184
Merged
Conversation
Jenkins showed "reverse proxy set up is broken" in Codespaces because codespacesURL.sh only edits the host-side jenkins.yaml, which is never read at runtime — the baked-in image copy is used instead. The discovery container (find-name.sh) already modifies /var/jenkins_home/jenkins.yaml and triggers a JCasc reload, so it is the right place to also set the correct root URL. Changes: - docker-compose.yaml: pass CODESPACE_NAME and GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN into the discovery container - find-name.sh: when those vars are present, update unclassified.location.url to the Codespaces forwarding URL and suppress the ReverseProxySetupMonitor admin warning - jenkins.yaml: add security.contentSecurityPolicy with a permissive but defined policy to clear the CSP administrative monitor warning Signed-off-by: Bruno Verachten <gounthar@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the Jenkins-on-Codespaces setup so Jenkins starts with a correct external root URL (avoiding reverse-proxy administrative monitor warnings) and with an explicit Content-Security-Policy configured via JCasC.
Changes:
- Pass Codespaces URL-related environment variables into the agent discovery / JCasC modifier container.
- Update
find-name.shto setunclassified.location.urlto the Codespaces forwarded URL and disableReverseProxySetupMonitorwhen running in Codespaces. - Add a baseline
security.contentSecurityPolicy.headerconfiguration todockerfiles/jenkins.yaml.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
docker-compose.yaml |
Forwards CODESPACE_NAME and GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN into the discovery container so it can compute the public URL at runtime. |
dockerfiles/agent-discovery/find-name.sh |
Detects Codespaces and patches JCasC (location.url + disables reverse-proxy monitor) before the final JCasC reload. |
dockerfiles/jenkins.yaml |
Defines a CSP header in JCasC to establish an explicit CSP baseline for Jenkins UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Apr 21, 2026
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.
Problem
Two administrative monitor warnings appeared in Jenkins when running under GitHub Codespaces:
"Reverse proxy set up is broken" —
codespacesURL.shpatches the localdockerfiles/jenkins.yamlon the host, but the controller uses a pre-built GHCR image where the file is baked in as/usr/share/jenkins/ref/jenkins.yaml.override. The host-side edit is never seen by the running container.CSP disabled — no Content-Security-Policy configuration was present in JCasc.
Root cause of the URL issue
The
discovery_and_jcasc_modifiercontainer (find-name.sh) already modifies/var/jenkins_home/jenkins.yamlat runtime and triggers a JCasc reload. It is the correct place to set the Codespaces root URL — but it had no access to theCODESPACE_NAME/GITHUB_CODESPACES_PORT_FORWARDING_DOMAINenvironment variables.Changes
docker-compose.yamlPass the two Codespaces env vars into the discovery container (Docker Compose forwards them transparently from the host environment; they are empty strings in non-Codespaces environments, so there is no impact on local or CI runs).
dockerfiles/agent-discovery/find-name.shWhen the Codespaces vars are set, update
unclassified.location.urlto the correct forwarding URL and addhudson.diagnosis.ReverseProxySetupMonitortodisabledAdministrativeMonitors. This runs before the final JCasc reload, so the correct URL is loaded on first startup.dockerfiles/jenkins.yamlAdd
security.contentSecurityPolicywith a policy that allows Jenkins' own UI to function (inline styles/scripts are required by Jenkins core) while establishing a defined CSP baseline.