nginx proxy_pass and proxy_cache

Francis Daly francis at
Thu Nov 11 09:02:12 UTC 2021

On Thu, Nov 11, 2021 at 08:54:21AM +0000, Francis Daly wrote:
> On Wed, Nov 10, 2021 at 08:58:54PM +0200, Reinis Rozitis wrote:


> You could possibly also take advantage of case#2, and do
> 	rewrite /something/(.*\.xml)$ /$1 break;

 	rewrite /something/(.*\.xml)$ /data/$1 break;

Along with "proxy_pass http://origin;".

> but that feels a bit too subtle to me.

That remains true.

> Note that the regex-matching attempts may not do what you want if you
> have %-encodings in the incoming requests -- test your use cases to see
> that things work for you.

That is: the case#3 regex-location does that in my testing; the case#2
rewrite does not. Initial request of /something/file%20name.xml.

> Or just use the map.

That also remains true ;-)


Francis Daly        francis at

More information about the nginx mailing list