Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request.URL always returns http even though SSL is enabled

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

like image 290
Suresh Avatar asked Sep 26 '12 09:09

Suresh


2 Answers

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.

like image 171
usr Avatar answered Nov 14 '22 17:11

usr


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

like image 28
gesirdekatwork Avatar answered Nov 14 '22 16:11

gesirdekatwork