Welcome! Log In Create A New Profile

Advanced

nginx proxy cache with same file name but any context

Posted by josea.guardia 
nginx proxy cache with same file name but any context
April 24, 2017 09:47AM
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;

}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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