IIS7 Application Request Routing HTTPS

2019-07-13 19:56发布

问题:

I have a reverse proxy that routes traffic to my app server..

I have login feature on my public website that is served through HTTPS. The SSL certificates are installed in the reverse proxy server only. My app server doesn't have SSL certificate. SSL Offloading is enabled in the reverse proxy server.

This works perfectly so far, I can access the login page and the member area via HTTPS. But, I notice that my session cookie is not secure...

I'm using .NET Membership Provider for authentication and this will generate ASPXAUTH session cookie as you all know. I tried to enable the httponly and secure flag for this cookie by:

  1. adding requiressl=true for the forms authentication variable in the web.config
  2. adding httpcookie variable with httponly and requiressl=true.

The first setting always gave me 502 error when I tried to login. 502 - Web server received an invalid response while acting as a gateway or proxy server.

The second setting gave me the httponly flag but not the secure flag (I disabled the first setting when testing this).

How to solve this..some questions:

  1. Do I need to install SSL in all servers, including my app server?
  2. Is there any workaround for this?

Please advise.

P.S.

I'm using IIS 7.5 (Reverse Proxy)

Application Request Routing (Reverse Proxy)

IIS UrlRewrite Module (Reverse Proxy)

IIS 8 (app server)

回答1:

Some applications are programmed to detect whether or not you are using HTTPS and since the actual web server is handling an HTTP request with your offloading enabled, it will think the request is not secure and often end up in a redirect loop.

You can fix this by setting up a single wildcard certificate on each content server and disable ssl offloading.

[ARR01 - ssl certificate] - [ARR02 - ssl certificate] <-- Visitors will see this SSL Certificate in their browser
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
[Content01 - wildcard ssl certificate] - [Content02 - wildcard ssl certificate] <-- This certificate remains hidden and thus can be a shared single wildcard cert.