Welcome! Log In Create A New Profile

Advanced

Re: Weird behavior when checking the existence of a cookie

Francis Daly
September 30, 2014 06:26PM
On Fri, Sep 26, 2014 at 02:02:12PM -0300, Marcello Rocha wrote:

Hi there,

> I have this location block:
>
> location /some_path/ {
> # this sets the mobile_rewrite variable based on a regex against
> the user_agent
> include /etc/nginx/mobile;
>
> # This is where the trouble lies. =/
> if ($cookie_mobileBypassDaily = yes_please) {
> set $mobile_rewrite do_not_perform;
> }

This is an "if" inside a "location" which does something other than
"return" or "rewrite...last".

Generally, that's a thing to avoid.

http://wiki.nginx.org/IfIsEvil

Can you move those three lines outside of the "location" block?

Actually: I suspect that the included file also does "if", so you may
want to move that outside of the "location" block too.

From your description, they both do not depend on the particular request,
so it may be ok to have them both at server{} level (and applying to
all requests).

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Weird behavior when checking the existence of a cookie

Marcello Rocha September 26, 2014 01:04PM

Re: Weird behavior when checking the existence of a cookie

wandenberg September 26, 2014 01:14PM

Re: Weird behavior when checking the existence of a cookie

Marcello Rocha September 30, 2014 04:28PM

Re: Weird behavior when checking the existence of a cookie

Francis Daly September 30, 2014 06:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 229
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