Welcome! Log In Create A New Profile

Advanced

Re: Other headers disappear after adding Set-Cookie header

Maxim Dounin
August 16, 2010 10:34AM
Hello!

On Mon, Aug 16, 2010 at 09:22:07AM -0400, Unimatrix02 wrote:

[...]

>
> # Serve generated HTML files directly, but expire immediately
> location ~ /static/generated/.*\.html$
> {
> # Set cookie with affiliate ID, if present
> if ($aff_id != "")
> {
> add_header Set-Cookie "iboodaffiliates=$aff_id; path=/;
> domain=.ibood.com;";
> }
>
> add_header X-DebugInfo aff_id=$aff_id;
> add_header X-Info "Served by nginx 1:$uri";

This code defines two locations. One of them has add_header array
set to "X-DebugInfo, X-Info" and another one (implicitly defined
by "if") has it redefined to "Set-Cookie".

You have to duplicate other add_header directives within implicit
location defined by "if", i.e.

location ... {
add_header X-DebugInfo ...
add_header X-Info ...

if (...) {
add_header Set-Cookie ...
add_header X-DebugInfo ...
add_header X-Info ...
}
}

Further reading:

http://wiki.nginx.org/IfIsEvil

[...]

> [b]debug log[/b]
> 2010/08/16 15:12:22 [notice] 24579#0: *1
> "(affiliate,|affiliate=)([a-z0-9]*)" matches
> "/nl/nl/index/affiliate,Affilinet/", client: 192.168.32.50, server: _,
> request: "GET /nl/nl/index/affiliate,Affilinet/ HTTP/1.1", host:
> "r.dev.ibood.com"

This isn't a debug log as you haven't recompiled nginx with
--with-debug option. Doesn't matter though, problem is clear from
the config itself.

Maxim Dounin

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

Other headers disappear after adding Set-Cookie header

Unimatrix02 August 16, 2010 07:57AM

Re: Other headers disappear after adding Set-Cookie header

Maxim Dounin August 16, 2010 08:24AM

Re: Other headers disappear after adding Set-Cookie header

Unimatrix02 August 16, 2010 09:22AM

Re: Other headers disappear after adding Set-Cookie header

Maxim Dounin August 16, 2010 10:34AM

Re: Other headers disappear after adding Set-Cookie header

Unimatrix02 August 16, 2010 10:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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