390: Allow same-origin iframe embedding for admin previews - #418
Merged
turegjorup merged 1 commit intoApr 30, 2026
Merged
Conversation
The admin embeds the client via iframe to render screen/playlist previews and the fullscreen slide view. With X-Frame-Options: DENY, the browser refused to render the iframe. Switch to frame-ancestors 'self' (CSP Level 2+, the modern control) and SAMEORIGIN as defense-in-depth for older browsers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tuj
approved these changes
Apr 30, 2026
turegjorup
merged commit Apr 30, 2026
21ba755
into
feature/update-infrastructure-for-mono-repo
18 checks passed
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 #390.
Summary
The admin embeds the client via iframe to render screen/playlist previews and the fullscreen slide view. The nginx template was sending
X-Frame-Options: DENY, so browsers refused to render the embedded iframe — exactly the failure shown in the issue's screenshot.Fix
Two-header approach in
infrastructure/nginx/etc/templates/default.conf.template:Content-Security-Policy: frame-ancestors 'self'— the modern primary control. CSP Level 2+ is honored by every current browser and supersedesX-Frame-Optionswhen both are present.X-Frame-Options: SAMEORIGIN— defense-in-depth for any pre-CSP-2 browser.Both restrict iframe embedding to the same origin, which matches the docker-server compose layout where admin and client are served by the same nginx on the same hostname.
The
Content-Security-Policyheader here only setsframe-ancestors; it does not activate any other CSP rules and so doesn't risk breaking inline scripts oreval. Future CSP work can extend this header with additional directives without disturbing the iframe rule.Local validation
Built the nginx image from this branch and confirmed both headers are present in the rendered config:
Test plan
curl -Iagainst any page response shows bothContent-Security-Policy: frame-ancestors 'self'andX-Frame-Options: SAMEORIGIN.🤖 Generated with Claude Code