Modifying or adding cookies via nginx.conf

Laurent Thevenet lthevenet at
Fri Mar 7 10:43:29 MSK 2008

On Thu, Mar 6, 2008 at 7:56 PM, Manlio Perillo <manlio_perillo at> wrote:
> Laurent Thevenet ha scritto:
> > On Wed, Mar 5, 2008 at 2:19 AM, Manlio Perillo <manlio_perillo at> wrote:
>  > [...]
> >>  What do you want to do, in detail?
>  >>
>  >
>  > I wanted to set up a language cookie depending on the url as googlebot
>  > is indexing all our content in english when the website is available
>  > both in french and in english.
>  How is the language selected?
>  It's strange if a cookie will solve the problem.

Initial language selection (as it can be change manually after) is
made based on your IP but i'm not in charge of that so i cannot tell
you exactly how it's working. I simply know a cookie is holding the
language selection after that, i just wanted to force it or to give
the web developer an indication about the language depending on the
url (if subdomain is for example).

The issue was concerning the search engine bots that would have
consider our pages to be duplicated as bots are not handling cookies
and google bot is for example always considered speaking english.

But we have dealt with the issue differently by doing all these things
in the web code so i'm not in charge of that anymore but adding
headers in nginx.conf was just one of the solution

>  > It's more a conception issue and i
>  > wanted a temporary but immediate solution, as nginx is in front of a
>  > mongrel cluster in fact and setting up a cookie was one of them.
>  >
>  > And yes it was your mod (parsed vars) that i saw ;)
>  >
>  You can try with:
>  add_header    Cookie  "lang=$request_url"

We hae done that, it was working fine but we change our plans finally
as it was only an immeida

>  If you need more control, then you have to write a custom extension.
>  Manlio Perillo

Laurent Thevenet
fonZz by 7Theories
M : +33 (0)6 74 71 84 44

More information about the nginx mailing list