Welcome! Log In Create A New Profile

Advanced

Re: Proxying to node.js + express.js, session doesn't persist

Maxim Dounin
July 21, 2011 12:14PM
Hello!

On Thu, Jul 21, 2011 at 11:45:36AM -0400, ilya wrote:

> Well, not really, since this happens _only_ when nginx is used.
> I and other people use Express sessions and they work, but in my case
> nginx somehow breaks them. The fact that session becomes flaky with
> introduction of nginx doesn't mean Express is broken, it means that
> nginx introduces some change that affects session.
> On the backend, sessions stored in Redis.

Are you see sessions not being flacky while working directly with
your backend?

> Looking at my config - does nginx pass all the headers from browser and
> backend to each other? Maybe it modifies them somehow? Connect.session,
> that Express uses
> (https://github.com/senchalabs/connect/blob/master/lib/middleware/session.js)
> uses this for fingerprinting:
>
> ---
> function defaultFingerprint(req) {
> var ua = req.headers['user-agent'] || '';
> return ua.replace(/;?\schromeframe\/[\d\.]+/, '');
> };
> ---
>
> and gets existing session like so:
> ---
> // get the sessionID from the cookie
> req.sessionID = req.cookies[key];
> ---
>
> So, can it be that nginx constantly modifies UA or filters out cookies?
> Or anything else?

No, nginx doesn't modify neither User-Agent nor Cookie headers
unless explicitly asked (with proxy_set_header directive).

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Proxying to node.js + express.js, session doesn't persist

ilya July 21, 2011 06:45AM

Re: Proxying to node.js + express.js, session doesn't persist

Maxim Dounin July 21, 2011 07:54AM

Re: Proxying to node.js + express.js, session doesn't persist

ilya July 21, 2011 11:18AM

Re: Proxying to node.js + express.js, session doesn't persist

Maxim Dounin July 21, 2011 11:36AM

Re: Proxying to node.js + express.js, session doesn't persist

ilya July 21, 2011 11:45AM

Re: Proxying to node.js + express.js, session doesn't persist

Maxim Dounin July 21, 2011 12:14PM

Re: Proxying to node.js + express.js, session doesn't persist

ilya July 21, 2011 12:28PM

Re: Proxying to node.js + express.js, session doesn't persist

Maxim Dounin July 21, 2011 04:54PM

Re: Proxying to node.js + express.js, session doesn't persist

ilya July 21, 2011 08:03PM

Re: Proxying to node.js + express.js, session doesn't persist

jzabel May 10, 2012 12:45PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 173
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready