I have config
location ~ \.(pdf)$ {
expires 2h;
}
location / {
...backend rules...
}
Now I want the first block to be executed only for really existing pdfs, otherwise the request would be passed to the backend.
I suppose I should add in the first location block try_files $uri @backend
:
location ~ \.(pdf)$ {
try_files $uri @backend;
expires 2h;
}
location / {
...backend rules...
}
location @backend {
...same backend rules...
}
But it turns out that both locations /
and @backend
will be absolutely identical, is there any way to combine them or should I just make two identical blocks?
include
.