We'd like to bypass a location if a query string varaible is present. Is this an approriate place to use "if", and if so, how should it be done? If the URL is a forward slash, followed by anything, followed by a forward slash, it attempts to find a static html.gz file in the cache folder matching the url, and then passes it to apache. This is the desired behavior, except when the URL contains ?nocache=true. If the nocache parameter is present, it should skip the cache check and go straight to the proxy pass.
This is the config we're using now:
location ~ ^/([a-zA-Z0-9\-]+)/ { #Use cache if possible, then proxy pass
try_files /cache/$1.html.gz /cache/$1.html @apache;
}
location / {
include /etc/nginx/apache-pass;
}
# Pass the PHP script to AquaCart
location @apache {
include /etc/nginx/apache-pass;
}
What's the correct way to bypass the ^/([a-zA-Z0-9\-]+)/ location when a specific query string parameter is set?