Giter Site home page Giter Site logo

Comments (4)

dstroot avatar dstroot commented on April 26, 2024

As I wrote the above I realized that since the app wasn't actually running over SSL and Nodejitsu was doing the SSL termination I turned off secure cookies and all is well with Safari.

Now I'm wondering how Chrome was working! ???

from csurf.

dougwilson avatar dougwilson commented on April 26, 2024

Now I'm wondering how Chrome was working! ???

It's possible Chrome had a cookie in there from you but not marked secure (perhaps it got there at a time in your development before you added the secure flag?). If you clear your cookies in Chrome and try it without SSL like Safari was, perhaps it will show the same behavior :)

from csurf.

dstroot avatar dstroot commented on April 26, 2024

Thanks Doug. I also discovered proxy: true in Express session. ;)

This works:

  app.use(session({
    secret: config.session.secret,
    name: 'sessionId',  // Use something generic so you don't leak information about your server
    cookie: {
      httpOnly: true,  // Reduce XSS attack vector
      proxy: true,     // Trust the reverse proxy when setting secure cookies
      secure: true,    // Cookies via SSL
      maxAge: config.session.maxAge
    },
    store: new MongoStore({
      mongoose_connection: db,
      auto_reconnect: true
    })
  }));

from csurf.

dougwilson avatar dougwilson commented on April 26, 2024

I also discovered proxy: true in Express session.

Ah yes. I guess it should really use express's helpers to get the protocol so it will use your "trust proxy" setting from our express app directly instead of setting it multiple times.

from csurf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.