Skip to content

fix(nginx): allow inline styles for the browser image viewer - #2

Merged
jamiehdev merged 1 commit into
mainfrom
fix/csp-image-viewer
Sep 27, 2026
Merged

jamiehdev merged 1 commit into
mainfrom
fix/csp-image-viewer

Conversation

@jamiehdev

Copy link
Copy Markdown
Owner

Opening an image URL directly in a browser showed the image unstyled in the top-left corner of a white page. Chrome and Firefox wrap a directly opened image in a viewer page styled with inline CSS. The default-src 'none' policy blocked those styles, and the browser console logged three CSP violations.

The policy now adds style-src 'unsafe-inline', the same policy raw.githubusercontent.com sends for raw files. Raster images cannot carry styles, and sandbox still blocks scripts, so embedding and hotlinking behave as before.

The change is already live on the reference deployment. Chrome's viewer now centres the image on its dark background.

@jamiehdev
jamiehdev enabled auto-merge (squash) September 27, 2026 11:36
@jamiehdev
jamiehdev merged commit 50d7ade into main Sep 27, 2026
2 checks passed
@jamiehdev
jamiehdev deleted the fix/csp-image-viewer branch September 27, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant