Cookie not created until refresh?

Broham nginx-forum at
Thu Nov 29 19:14:44 UTC 2012

I have the following nginx conf file (shortened for the purose of this
question) that is creating a cookie:

    map $http_referer $setCookie {
            default "";
        listen 80;
        root /var/www/;
        access_log /var/log/nginx/ spiegle;
        add_header Set-Cookie $setCookie;
        location  /{
                    #add_header Set-Cookie $setCookie;

The issue is that if I click on a link on `` it navigates to
mysite, but does not create the cookie.  If I then refresh the page it will
create the cookie.  Why do I have to refresh to have the cookie created and
how can I get around this?

Posted at Nginx Forum:,233395,233395#msg-233395

More information about the nginx mailing list