set cache-control in a subfolder (php)

Francis Daly francis at daoine.org
Thu Nov 17 13:47:50 UTC 2016


On Thu, Nov 17, 2016 at 04:17:36AM -0500, JoakimR wrote:

Hi there,

> Hi I'm trying to override my default cache-control in my /admin/ folder

One request is handled in one location.

Only the config that applies in that location applies to the request.

> 	location /admin/ {
> 		add_header “Cache-Control: no-cache”;
> 		try_files $uri =404;
> 		access_log off;
> 	}
> 
> but everything have a wrong cache-age by running curl -I
> 
> curl -I https://domain/admin/index.php
> HTTP/1.1 302 Moved Temporarily

That suggests that the request for /admin/index.php is not handled in
the location that you show.

Put the config that you want in the location that is used; or perhaps
make a new location for the requests that you care about, and make all
of the config that matters apply in that location.

> My goal is to have no-cache on all php files in this subfolder. Any one who
> could help me?

Populate "location ~ ^/admin/*.php$ {}", perhaps?

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list