Welcome! Log In Create A New Profile

Advanced

Skip Location Based On Query String Parameter?

November 13, 2014 06:20AM
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?
Subject Author Posted

Skip Location Based On Query String Parameter?

nrahl November 13, 2014 06:20AM

Re: Skip Location Based On Query String Parameter?

Francis Daly November 13, 2014 06:20PM

Re: Skip Location Based On Query String Parameter?

nrahl January 04, 2015 09:12AM

Re: Skip Location Based On Query String Parameter?

nrahl January 04, 2015 09:46AM

Re: Skip Location Based On Query String Parameter?

Francis Daly January 07, 2015 06:36PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 219
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready