I have prepared an ASP.NET web application (ASP.NET V2.0) and I configured it in my IIS (V7.5). I used Request.Url.AbsoluteUri in my application and it works fine in my server. I deployed the web application on my client's server machine (2008 R2 Server). But in my client's environment Request.Url.AbsoluteUri always return http url even though they enabled SSL. Whether any IIS settings configured on my client's server machine? Please guide me
Asked
Active
Viewed 6,539 times
8
-
Is the site running under HTTPS? i.e. does the browser bar show `https://`? – James Sep 26 '12 at 10:08
-
Is it a plain SSL setup on the site in which your application runs? (i.e. default ports, site is configured with the same address as the users type) – Damien_The_Unbeliever Sep 26 '12 at 10:11
-
@James : "Yes its running under HTTPS and also browser bar show https://" – Suresh Sep 26 '12 at 10:12
-
@Damien_The_Unbeliever: "Yes its running under default port" – Suresh Sep 26 '12 at 10:14
2 Answers
12
I have seen this before. The reason was that the load balancer at the production site terminated the SSL connection. It by itself connected to IIS using HTTP only. This scheme is a way to offload the SSL computations to the load balancer. It means that the IIS application does never see the HTTPS protocol although the browser does see it.
As spender pointed out in the comments, please see the HTTP headers arriving at your application. The load balancer is likely to add information to them that allows you to reconstruct everything.

usr
- 168,620
- 35
- 240
- 369
-
1Indeed. IIRC there's a bunch of extra headers starting "x-forwarded" sent to the webserver by some load balancers that will help you figure out whether the original request came over https. +1 – spender Sep 26 '12 at 10:25
-
@usr: "Thanks for your response. How do I detect the load balancer which its configured on my client server? and Which HTTP header is used for load balance? – Suresh Sep 26 '12 at 10:44
-
1) ask the client. 2) Depends on the device. Look at the docs or just dump all headers. – usr Sep 26 '12 at 16:42
-
1@spender: Could you please tell me the exact header name. Because I only seen the header 'X-Powered-By' in my iis settings and that is working properly in my server.I want to reproduce this problem in my server. +1 – Suresh Sep 27 '12 at 05:50
-
This saved my day. I had exactly the same problem. In my case, not only the protocol switched from https to http, but also the domain changed. Turned out to be a load balancer. – NetWave May 12 '14 at 14:55
1
If you want to check whether request is HTTP or HTTPS. You should check headers. Below link really helped me to solve it.
http://www.bugdebugzone.com/2013/12/identifying-https-or-ssl-connection-in.html

gesirdekatwork
- 87
- 2
- 11