CSP blocks resources
Steps to reproduce
- Fresh Install of Nextcloud Docker (nextcloud:17, nextcloud:16, nextcloud:latest)
- Access the Nextcloud instance
- Check webconsole in browser
Expected behaviour
Resources should not be blocked by CSP.
Actual behaviour
Resources are blocked by CSP.
Server configuration
Operating system: Debian 10 Buster (from Nextcloud Docker Image) Web server: Apache through Nextcloud Docker Image (nextcloud:17, nextcloud:16, nextcloud:latest) Database: mariadb PHP version: 7.3 (from Nextcloud Docker Image) Nextcloud version: (see Nextcloud admin page)
Updated from an older Nextcloud/ownCloud or fresh install: fresh install Where did you install Nextcloud from: Official Nextcloud Docker Image (nextcloud:17, nextcloud:16, nextcloud:latest)
Prod Instance:

Local nonprod instance:

Maybe this issue is also related to https://github.com/nextcloud/server/issues/17781 Signing status:
Signing status
Client configuration
Browser: latest Firefox and latest Chrome Operating system: Ubuntu
Info for anyone who is still seeing requests blocked by CSP in Firefox (even without any extensions) - this appears to be a bug in Firefox.
Details are here https://bugzilla.mozilla.org/show_bug.cgi?id=1591807
https://github.com/nextcloud/server/issues/12724#issuecomment-548361148
Are you able to reproduce the same with chromium browsers?
I am having the same issue. Pages are taking over a minute to load.
Browsers Attempted: Chrome (Desktop and Mobile), Firefox (Desktop and Mobile), Edge (Desktop), Safari (Desktop and Mobile) Screenshot: Imgur
The NextCloud mobile apps (NextCloud, Bookmarks, Notes, etc) all work fine, WebDav is working fine. Seems to just be an issue with the content policy for browsers.
I wanted to chime in and say I think I solved the issue, turns out it may not be related to browser bug.
- I turned on
loglevel => 0in config. - Reloaded my page.
- Watched the log via SSH.
- I seen complaints of attempting to compile server.scss but file was locked, being spammed many time.
Solution:
- I had file locking turned on in my config
- I disabled file locking in config
- I disabled memcache in config
- I disabled "theming" app via CLI
- Rebooted the server
- Went to my nextcloud URL
- Success, no errors
Maybe just my case but thats what solved it for me...
EDIT: Reenabled "themeing" app after I had a successful page load. No issues reenabling. Going to attempt to turn back on caching.
@ohmybrew could you share the exact message for the locked server.scss?
cc @juliushaertl
@kesselb Two messages:
Failed to compile and/or save /var/www/nextcloud/core/css/server.scssspammed inCould not find resource css/server.css to loadon page load
Disabling the memcache/filelocking solved the issue for the moment, NextCloud was able to rebuild the missing assets (not sure why they disappeared).
I re-enabled it, and all was fine.
I really think the CSP error (for me anyways) came from the fact NextCloud was trying to build those assets, because anything going to /core is directed to PHP/NextCloud, while the page was loading. Due to the locking/memcache it was unable to build the assets, timed out, and caused the CSP error.
Can confirm this bug exists in NC 17.0.2 It was introduced in the upgrade from NC 16
I'm seeing this error as well.

Not a nextcloud issue:
Info for anyone who is still seeing requests blocked by CSP in Firefox (even without any extensions) - this appears to be a bug in Firefox.
Details are here bugzilla.mozilla.org/show_bug.cgi?id=1591807
@juliushaertl please do not close a valid issue. This is not unique to Firefox. As stated above this is seen in all browsers. This has also been my experience since upgrading to nextcloid 17.
If you can reproduce with Chrome please share the network tab from chrome as well as the console log.
@brandonkal Please also try to provide a more detailed description of which issue you encounter.
The first report is clearly the firefox issue. Somehow people hijacked the issue with their problem. We don't have a valid issue template except the firefox one so I'm closing this again. Feel free to report a new issue with the initial template so someone can have a proper look.
Still getting this error
The screenshot is from v18.0.2
I also just installed a clean install of NextCloud (18.0.2) and the same issue is present.
Compare curl -I https://cloud.aljaxus.eu with curl -I https://demo2.nextcloud.com and figure out the difference. I would try to disable cloudflare in the first place and check if that might be the issue. Please ask the friendly people at https://help.nextcloud.com/ for advice. GitHub is for bugs not for configuration issues.
Compare
curl -I https://cloud.aljaxus.euwithcurl -I https://demo2.nextcloud.comand figure out the difference. I would try to disable cloudflare in the first place and check if that might be the issue. Please ask the friendly people at https://help.nextcloud.com/ for advice. GitHub is for bugs not for configuration issues.
Fair.
- CloudFlare is not the problem. I also, as mentioned, tested a clean install on another box, on another domain and the same problem was present.
- I will turn to NextCloud forums.
Thank you for such fast reply.
No cloudflare here and same error.
Same problem here. Fresh installed Nextcloud...
Same problem, Nextcloud 18

@kesselb as you can see many people are facing this issue. Could you please check if it makes sense to reopen this issue? Thanks
What issue are you facing exactly? Is there something broken or just the blocked resources in networks?
juliushaertl posted a link to mozilla's bug tracker about 5 months ago. That issue is open.
If you see those blocked csp requests in Firefox but not with Chrome (or any other chromium based browser) and your instance works fine there is nothing to worry.