Francis Daly
February 05, 2014 08:34AM
On Wed, Feb 05, 2014 at 01:49:59AM -0500, justink101 wrote:

Hi there,

> I was under the impression that if you set headers in the
> server block, ALL location blocks below inherit those headers.

No.

Can you say where you got that impression? Perhaps documentation can be
clarified or corrected.


The request is handled in one location block.

Only the configuration in, or inherited into, that location block,
matters.

Configuration in the location block overrides anything that might otherwise
have been inherited.

> location ~* \.(?:ico|js|css|gif|jpe?g|png|xml)$ {
> expires 7d;
> add_header Pragma public;
> add_header Cache-Control "public, must-revalidate, proxy-revalidate";

"add_header" here means that no "add_header" directives are inherited --
only these two apply.

> When requesting a .js file, the Pragma and Cache-Control headers are set,
> but all the headers set in the base server block are not.

That is working as intended.

> What is the fix here?

If you want configuration in the location block, put all of the
configuration in the location block.

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

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

justink101 February 05, 2014 01:49AM

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

Francis Daly February 05, 2014 08:34AM

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

Maxim Dounin February 05, 2014 08:54AM

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

Francis Daly February 05, 2014 10:12AM

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

Maxim Dounin February 05, 2014 11:44AM

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

justink101 February 05, 2014 10:55AM

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

itpp2012 February 05, 2014 01:51PM

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

Francis Daly February 05, 2014 07:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 125
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready