Simple session persistence base on IP address?


#1

I’ve read that ppl use NginxHttpUpstreamRequestHashModule for session
persistence. But I’m not sure how it works. Where can I get documention
about it?
Have any more simple way to do session persistence base on client IP
with
nginx?
giobuon.


#2

I’ll give you the advice I give everyone else: forget session
persistence. Use a central session store. Plenty of options out there
for it. To me session persistence and such is how it was done in the
90’s…

  • my two cents :slight_smile:

#3

On Tue, 2008-10-28 at 11:41 -0700, mike wrote:

I’ll give you the advice I give everyone else: forget session
persistence. Use a central session store.

Or a distributed session store if scalability is a big concern.
Memcached is designed to do this very thing.

Cliff


#4

yes that’s what i meant with “plenty of options”

depending on how important sessions are you can determine if you need
memcached alone, memcached with db-backing (what is that, a
“write-through cache” ?) etc


#5

Thanks all. But what about SSL or some services like ftp?


#6

On Wed, 2008-10-29 at 14:16 +0700, Gio wrote:

Thanks all. But what about SSL or some services like ftp?

Both are irrelevant, SSL must be handled by the proxy regardless of
where the request is ultimately forwarded (limitation of SSL, not
Nginx), and Nginx doesn’t proxy FTP, only HTTP (and IMAP/POP3, if you
choose).

Regards,
Cliff


#7

Have any more simple way to do session persistence base on client IP
with nginx?

Use “$remote_addr” var.
Like this.

 upstream www {
     server x.x.x.x:80 ;
     server y.y.y.y:80 ;
     hash   $remote_addr;
 }