Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

nginx proxy cache with same file name but any context

$
0
0
Hello.

I want to caching some html files, with the same file name, but with any (wildcard?) context. It's a bit difficult to me to explain, but:

domain.com/getContentById /123456/abcdef/content.html
domain.com/getContentById /123456/fedcba/content.html
domain.com/getContentById /123456/blahblah/content.html

All this are the same "content.html" and need to be caching as the same file


domain.com/getContentById /654321/abcdef/content.html
domain.com/getContentById /654321/fedcba/content.html

Another content.html, but need caching too (only to the last 2 URLs).

My nginx related config doesn't works:

location ~* /getContentById {

proxy_pass http://servers;
proxy_cache mycache;

proxy_connect_timeout 5s;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;

}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>