Welcome! Log In Create A New Profile

Advanced

Re: Are headers set in the server block inherited to all location blocks

February 05, 2014 10:55AM
Gosh that is horrible that I have to copy and paste shared headers in the server block, to all location blocks. Is this a conscious decision? This makes maintainability very difficult as i have to do something like:

[code]
# shared_headers.conf
add_header Alternate-Protocol 443:npn-spdy/3;
add_header Strict-Transport-Security max-age=31556926;
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;

# expires.conf
location ~* \.(?:ico|css|gif|jpe?g|png|xml)$ {
include shared_headers.conf;

expires 7d;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

server {
...
location ^~ /icons {
include shared_headers.conf;

add_header Access-Control-Allow-Origin *;
}

location ^~ /docs {
include shared_headers.conf;

auth_basic "Docs";
auth_basic_user_file /etc/nginx/auth/docs.htpasswd;
}

location ^~ /actions {
include shared_headers.conf;

add_header Access-Control-Allow-Origin https://www.mydomain.com;
}
}
[/code]

Or, is there a better way to do this?
SubjectAuthorPosted

Are headers set in the server block inherited to all location blocks

justink101February 05, 2014 01:49AM

Re: Are headers set in the server block inherited to all location blocks

Francis DalyFebruary 05, 2014 08:34AM

Re: Are headers set in the server block inherited to all location blocks

Maxim DouninFebruary 05, 2014 08:54AM

Re: Are headers set in the server block inherited to all location blocks

Francis DalyFebruary 05, 2014 10:12AM

Re: Are headers set in the server block inherited to all location blocks

Maxim DouninFebruary 05, 2014 11:44AM

Re: Are headers set in the server block inherited to all location blocks

justink101February 05, 2014 10:55AM

Re: Are headers set in the server block inherited to all location blocks

itpp2012February 05, 2014 01:51PM

Re: Are headers set in the server block inherited to all location blocks

Francis DalyFebruary 05, 2014 07:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 59
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready