Situation:
Load balanced environment where SSL terminates on the LB and all traffic below it is HTTP. We have pages with require user to be authenticated and we also have a requirement that authentication cookie carries flag "secured". Whole website must run under SSL.
I want to simulate on my local machine the live environment, i.e. I want to configure "secured" cookie under HTTP connection. Sofar, I managed to get to the point where:
Request.IsSecureConnection == true; Request.ServerVariables["HTTPS"] == "on"; I'm doing this by manually adding https variable in IIS:
<rewrite> <rules> <rule name="HTTPS_Always_ON" patternSyntax="Wildcard"> <match url="*" negate="false" /> <serverVariables> <set name="HTTPS" value="on" /> </serverVariables> <action type="None" /> </rule> </rules> </rewrite> The problem is that I am still not able to read authentication cookie under HTTP. I have to explicitly switch to https connection.
Is it possible to trick asp.net to read secured cookie under http connection? If so, then what do I need to do?
UPDATE: my post describes the problem but is not fully correct. Browsers don't send cookies marked as "secure" over HTTP, so there was no way to test my code directly. I needed to emulate the Load balancer which terminates SSL and forwards all traffic over HTTP to the actual web servers. It appears that you can do this on a single machine without major difficulties.