I have the following nginx config:
server {
location ~ ^/(\d+)/(\d+)/(\d+)\.png$ {
alias /mount/cache/c/$1/$2/$3.png;
try_files $uri @proxy;
add_header x-source file;
}
location @proxy {
proxy_pass http://127.0.0.1:28000;
add_header x-source proxy;
}
}
What I'm trying to achieve is to try to load the files from disk, and if they are not found only then ask the upstream for it.
My problem is that try_files
doesn't seem to work, it always requests @proxy (x-source header is always proxy). If I comment out try_files
then it loads the files from the disk correctly, but then the proxy part doesn't work.