Reputation: 8318
I have a static mirror of a website which is good for all normal pages. But when ever a user fetches a page with a URL parameter I want it directly to try @proxy
and not the local static file.
https://www.example.com/test.html?query=foobar
should fetch from @proxy
https://www.example.com/test.html
should first try to fetch from $uri $uri.html $uri/
Here is my current config:
root /var/www/www.example.com/mirror/current;
location / {
expires 12h;
add_header Cache-Control public
try_files $uri $uri.html $uri/ @proxy;
}
Unfortunately this config delivers always the static page when there is one and doesn't take care about any URL parameters.
How can I solve this?
Upvotes: 0
Views: 334
Reputation: 6864
Try this - If there is a parameter, use @proxy.
location / {
error_page 404 = @proxy;
if ($args != "") {
return 404;
}
try_files $uri $uri.html $uri/ @proxy;
}
Upvotes: 1