-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hint about duplicated headers #674
Conversation
If you use the default settings for nginx from the docs, it would make also sense to put this line in the default configuration examples?? |
Well... that doesn't make things any clearer. |
@MorrisJobke would be great to get some feedback here. |
@@ -71,9 +69,14 @@ webroot of your nginx installation. In this example it is | |||
add_header X-Robots-Tag none; | |||
add_header X-Download-Options noopen; | |||
add_header X-Permitted-Cross-Domain-Policies none; | |||
fastcgi_hide_header X-Content-Type-Options; | |||
fastcgi_hide_header X-XSS-Protection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not remove them by default, because then it could be that those are not set by the web server as well and causing a security problem.
|
||
.. code-block:: nginx | ||
|
||
fastcgi_hide_header X-XSS-Protection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this separate section, that we maybe also could link from the admin settings, so that admins directly know where it is coming from and how to fix it in their environment.
cc @josh4trunks for the general Nginx explanation. |
Sorry, I am not 100% familiar with these security headers. Is my understanding below correct?
If all the above is true, then this PR makes sense to me and looks correct. Personally, I don't add any headers with NGINX except Cache-Control. But, I do add HSTS with an upstream Varnish server. |
Those are correct, except that the security headers only need to be added to the served HTML files and not the JS/CSS. Those just define what JS is allowed to be loaded and executed within this HTML. The problem with the config is, that some distros adds some headers automatically and thus the ones from PHP are then duplicating those headers. So it should only be added in distros that add those headers already and not on all installs, because then it would lack those headers on vanilla distros, that don't add anything by default. |
@MorrisJobke in this PR, the five headers being removed by fastcgi_hide_header are being added just before it so I do not see how these would not exist if all 10 of these lines are in a location in their config?
I do not understand your point how a distro can have any affect on what headers NGINX sends in this case. Once |
I wonder if it is possible to do this to make sure anything stripped from PHP response is already added.
|
Didn't knew that, but we had a lot of people complaining, that our checks for the headers fail and then they looked it up in the response and the header was there twice. :/ |
This PR should fix that (thought I have not had a chance to test it myself). Or they can be like me and just not add any header in NGINX (except Cache-Control), just let PHP handle it, and i have none of those errors |
We told this the people a lot of times and also linked directly to that ticket. Nevertheless it pops up every second week :/ |
Setting the header on nginx makes sense because of nextcloud/server#8207 (comment) and you may want to customize (being more restrictive) the headers (nextcloud/server#8207 (comment)). |
What's the status of this? Because I'm facing the same issue. I don't understand why the same headers are being set on |
@francoism90 This does not acutally change NExtcloud's code so you are free to read the resultant docs and use that to configure NGINX. To understand why headers are set in multiple location is covered in my 3rd point here. |
See issue described in nextcloud/server#8207
Any news here? |
See issue described in nextcloud/server#8207
cc @MorrisJobke