Search code examples
node.jsiisurl-rewritinghostingpassport-local

IIS and node.js configuration for passport.js local strategy


I have created a chat application in node js,socket-io and used passport js for user authentication.

While deploying my app to IIS server I used url rewrite module default option.

I refer this post :- https://dev.to/petereysermans/hosting-a-node-js-application-on-windows-with-iis-as-reverse-proxy-397b

Problem :

I have used reverse proxy which redirect request of localhost to my application port.

Everytime

When new user login. It's session is applied to every other users.

Example:

If A is last login and B request authcaticated page without login then B gets profile page of User A.

Same now if B logins users A will get profile page of user B.

I don't know how to solve this . But I think problem is in url rewrite rules or cookies used my passport.js

My bad luck is I have to use IIS server . So pls help me.


Solution

  • This is the cache-related issue you could solve the issue by disabling the cache and kernel cache in iis.

    1)Open iis manager, select your site.

    2)Double click on the output caching from the middle pane.

    enter image description here

    3)On the right side under Actions, click on Edit Feature Settings

    4)Uncheck Enable Cache and Enable kernel cache

    5)Click OK

    enter image description here

    You could also disable client cache in iis:

    Client Cache