Welcome! Log In Create A New Profile

Advanced

RE: nginx proxy_pass and proxy_cache

Reinis Rozitis
November 10, 2021 02:00PM
> And I can't make a location block for a mimetype, or using another specifier than regexes to filter out requests to certain 'file types'. Is there any other 'good' solution except for, on my origin adding rewrites from /something/data1/ to /data1/?


Why just not separate the locations rather make them nested?

Something like:

location /something/ {
proxy_cache disk_cache;
proxy_pass http://origin/data1/;
}

location ~* ^/something/.*\.xml$ {
proxy_cache fast_disk_cache;
proxy_pass http://origin/data1/;
}


If you don't want to multiply the whole location { proxy_pass } configuration you can use the map directive (http://nginx.org/en/docs/http/ngx_http_map_module.html) and just change the proxy_cache on the fly (you can easily add multiple cache locations this way):

map $request_uri $cache {
^/something/.*\.xml fast_disk_cache;
default disk_cache;
}

server {
location /something/ {
proxy_cache $cache;
proxy_pass http://origin/data1/;
}
}


rr

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx proxy_pass and proxy_cache

Michiel Beijen November 10, 2021 10:30AM

RE: nginx proxy_pass and proxy_cache

Reinis Rozitis November 10, 2021 02:00PM

Re: nginx proxy_pass and proxy_cache

Francis Daly November 11, 2021 03:56AM

Re: nginx proxy_pass and proxy_cache

Francis Daly November 11, 2021 04:04AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 129
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready