mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-04-25 08:45:58 +03:00
[GH-ISSUE #1050] Strict CSP (Content Security Policy). #564
Labels
No labels
Q/A
bug
casdoor
dependencies
docker
documentation
duplicate
enhancement
help wanted
invalid
lego
platform:openwrt
platform:windows
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-ui#564
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @uphv on GitHub (May 13, 2025).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/1050
Hi,
When enabling strict CSP:
Content-Security-Policy: default-src 'self' img-src 'self' script-src 'self' object-src 'none' https: wss: frame-ancestors 'self'
Nginx-UI breaks.
Nginx-UI is served via Nginx proxy location.
Might also be my mistake. Couldn't find anything in the docs.
Thanks!
@0xJacky commented on GitHub (May 13, 2025):
I don't quite understand what you mean. Could you provide the configuration file, browser screenshot, and nginx-ui log?
@uphv commented on GitHub (May 21, 2025):
I have configured the CSP as such:
Content-Security-Policy: default-src 'none'; connect-src 'self' ws: wss:; img-src 'self' wss: ws: data: blob:; style-src 'self' wss: ws:; font-src 'self' wss: ws:; script-src 'self' *.cdn-apple.com wss: ws:; base-uri 'self'; object-src 'none'; frame-ancestors 'self';
as opposed to the proposed from Nginx-UI:
Content-Security-Policy "default-src 'self' http: https: ws: wss: data: blob: 'unsafe-inline'; connect-src 'self' https://www.oldforest.xyz ws: wss:; frame-ancestors 'self';" always;
This breaks the wss:// calls from Nginx-UI frontend to the server with messages like:
WebSocket connection to 'wss:////api/self_check/websocket?token=' failed: The network connection was lost
I am running Nginx-UI proxied behind a location as per configuration instructions. I added the proposed CSP to the proxied location but still getting this message.
I guess I'll have to recheck the CSP manuals.
If there is any idea / suggestion, I'll be happy to hear / test it.
Many thanks