nginx servers share session or cookies

Francis Daly francis at daoine.org
Wed Mar 27 22:48:58 UTC 2019


On Mon, Mar 25, 2019 at 04:11:50PM +0800, David Ni wrote:

Hi there,

>    I tried to set cookies like this

You should not be setting cookies, in this case.

If your "session" information is handled by cookies, you must modify the
cookies before they go to the client, in order to convince the client
to send the cookies back to both of your servers. If your session
information is not handled by cookies, adding cookies (or any "Single
Sign-On" mechanism) is a more involved job.

>From reading the docs for one auth_lap module, it looks like it uses http
Basic Authentication, and not cookies. Maybe the one you use does, too.

In that case, the client will not send the credentials for one web
server to another web server. So the way to get the client to send the
same credentials to both, is to present them as one web server -- for
example by using nginx as a reverse-proxy in front of both.

With that, you would need some way of knowing which requests correspond
to which back-end server, while using the same server name.

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list