cookie injection / verification / redirect

Payam Chychi pchychi at
Fri Jan 23 07:27:36 MSK 2009

Hey Guys,

Im trying to see what the best way of doing this would be... any and
all thoughts are greatly appreciated.

a) client --> proxy --> [cookie set?] if yes, proxy connection to
$origin. call it a day
b) client --> proxy --> [cookie set?] if no, set cookie, redirect
client to proxy and see if the cookie is set, if No, keep looping; if
yes, proxy connection to $origin.

I see that you can use the following ways to inject cookie into the header:

        add_header    Cookie  "mysuperdoopercookiehere";
        userid          on;
        userid_name     uid;

Using firefox cookie header add-on, ive been able to confirm that the
cookie injection works just fine however, I haven't a clue on how to
properly write the redirect so that if the cookie is not set, set it
and have the client re-establish connection with the cookie added to
the header  and if the connection has a cookie set then pass it to the

Any help with this would greatly be appreciated... ive been banging my
head to my desk for the last 2 days.

Thanks in advance,

More information about the nginx mailing list