Skip Location Based On Query String Parameter?
Francis Daly
francis at daoine.org
Wed Jan 7 23:35:04 UTC 2015
On Sun, Jan 04, 2015 at 09:12:40AM -0500, nrahl wrote:
Hi there,
> > > location ~ ^/([a-zA-Z0-9\-]+)/ { #Use cache if possible, then
> > proxy pass
> >
> > if ($arg_nocache = true) {
> > include /etc/nginx/apache-pass;
> > }
> >
> > > try_files /cache/$1.html.gz /cache/$1.html @apache;
> > > }
> >
> > could possibly work.
>
> When trying to use if(){include} I get the error, "'include' directive is
> not allowed here",
You are correct; I hadn't tested it -- I had read "Context: any" on
http://nginx.org/r/include and had incorrectly assumed.
But if I just use the "proxy_pass" directive instead of the "include",
then it seems to work for me (going to the upstream without attempting
/cache/ files first).
> Maybe it can be done by using a nested location blocks, something like:
Query string does not take part in location matches, so this won't work.
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list