-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
map HTTPS server variable to x-forwarded-proto header #265
Comments
You can accomplish this scenario by using In your iisnode.yml:
In your server.js:
|
yes, this is what I did and what i'm showing you on my code snippet. but I just would like to have |
I'd second the request to use X-Forwarded-Proto for this. We're using IIS to accept both HTTP and HTTPS traffic, and just forward them to the same node instance--but it's important to know which protocol was used for the initial request. Tomasz, I'll use your suggestion to meet my needs for now, but I think it would be good to standardize on the other header, at least for something as common as this. |
Also, read the section about Express behind proxies. Setting the X-Forwarded-* headers would make it a lot easier to get the info needed on the client in an Express.js app. |
just to note it should be : not = in iisnode.yml, in case anyone just cut/paste's like I did.
|
+1 on this. Spent about a day figuring out I needed to set x-forwarded-proto="HTTPS", then add this middleware layer: and set proxy:true on session just to get secure cookies to work. If this header was added automatically, I would have only had to do the last step. |
In express.js, "trust proxy" mode allows is to properly handle the scenario of being behind a proxy server, while still properly exposing the client IP/protocol from the request object. The enableXFF configuration option for iisnode propagates the X-Forwarded-For header, but not X-Forwarded-Proto. This commit adds the X-Forwarded-Proto header as well, in scenarios where enableXFF is true. For details, see: tjanczuk#265
I wonder if you could map the
https
server variable ON/OFF to thex-forwarded-proto
header HTTP/HTTPS.I guess this is the best because all examples run a node http server, so I see iisnode somehow as a reverse proxy.
Right now I am promoting the server variable in the web.config and then doing something like this:
@Gissues:{"order":50,"status":"inprogress"}
The text was updated successfully, but these errors were encountered: