Welcome! Log In Create A New Profile

Advanced

Re: Proxy Caching ignore path

Francis Daly
August 07, 2019 03:30AM
On Tue, Aug 06, 2019 at 10:27:57AM -0400, jvanetten wrote:

Hi there,

> I have a situation where I need to enable proxy cache for a gateway but
> anything that goes to /gateway/public/files/ I do not want to cache. I have
> tried nested locations and all kinds of configurations with no success. It
> usually lands up with 404 errors on /gateway/public/files/ the complete url
> includes a file reference like so /gateway/public/files/kd774831ldja3
>
> caching is working for anything going to /gateway/

In nginx, one request is handled in one location. Only the config in,
or inherited into, that location, matters.

And you can nest some location{}s, if you want to inherit config
between them.

So if I've understood what you want to do, the simplest way is probably
to add a nested

location /gateway/public/files/ {
proxy_cache off;
rewrite ^/gateway/(.*) /$1 break;
proxy_pass $elb;
}

within your current "location /gateway/ {" block.

"proxy_pass" does not inherit, so needs to be there.

"rewrite" does not inherit, so needs to be there.

"proxy_cache" does inherit, so needs to be disabled if you do not want
to proxy_cache things from upstream's /public/files/.

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Proxy Caching ignore path

jvanetten August 06, 2019 10:27AM

Re: Proxy Caching ignore path

itpp2012 August 06, 2019 11:27AM

Re: Proxy Caching ignore path

jvanetten August 06, 2019 12:12PM

Re: Proxy Caching ignore path

itpp2012 August 06, 2019 04:04PM

Re: Proxy Caching ignore path

Francis Daly August 07, 2019 03:16AM

Re: Proxy Caching ignore path

Francis Daly August 07, 2019 03:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 294
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