portainer: Cannot have Portainer work behind nginx due to CSP
Question:
How can I deploy Portainer behind a nginx reverse proxy ?
I’ve used the following directives found in the documentation
location /portainer/ {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://portainer/;
}
location /portainer/ws/ {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_pass http://portainer/ws/;
}
It’s working fine except an issue with the Content-Security-Policy as Portainer calls matomo cdn though http instead of https.
Browser is not happy if I use “http://cdn.matomo.cloud” in the CSP header (This page has a non-HTTPS secure origin.)
Portainer is not happy is I use “httpS://cdn.matomo.cloud” as this is not the one it calls internally.
Any thoughts ?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 32 (12 by maintainers)
Hum… from what I saw the ui cannot be loaded because it used http instead https to get matomo assets. When you updated to https it was working fine though. I guess using https by default should be safer no ? Sorry, I’m not able to test it right now, I’ve just moved to Traefik instead of nginx (not linked to Portainer though 😃 ).
On Sun, Jan 17, 2021 at 10:24 PM Anthony Lapenna notifications@github.com wrote:
@deviantony Sorry for not coming back to you before. I’m currently using the custom image which works fine. I’ll test once again with 2.0.0 instead to be sure the cdn over https fixed the thing (but I’m pretty sure it did as CSP was raising an error when it was on http).
Seems it’s much better adding the upgrade-insecure-requests instruction to the CSP header 👍