Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sitecore with requireSSL for cookies

Our Sitecore 6.6.0 (rev. 120918) based website can work over http as well as https. We also have a security requirement of making all the cookies to transfer over SSL regardless of whether the website is accessed via http.

We have achieved this requirement by using the requireSSL property in the web.config as described here: How can I set the Secure flag on an ASP.NET Session Cookie?

With this change, our public website works fine and when analyzed in Firebug, we can see that all cookies are "secure" even when the website is accessed via http.

But the problem is when I try to login to the sitecore admin portal via http, it throws the error The application is configured to issue secure cookies. These cookies require the browser to issue the request over SSL (https protocol). However, the current request is not over SSL. The only way I can access the sitecore admin portal is via https. Even with https, it gives some weird issues. After some time of use, it says that lot of admin users are logged in and I have to kick some out to get in. I also can't access the admin portal remotely.

Why is it that the public website works with SSL cookies, but the sitecore admin portal has issues with SSL cookies. Could it be and incompatible configuration in our site?

like image 277
ravinsp Avatar asked Nov 13 '22 03:11

ravinsp


1 Answers

I think the problem will be that you have set <httpCookies requireSSL="true" /> which will set the cookies to secure, but also have to set the forms authentication:

<system.web>
    <forms requireSSL="true">
        /* forms content */
    </forms>
</system.web>

As this would override the cookie setting. The problem is having that set on the forms section requires that the login happen over https not http. On your public website, you will only see this issue if there is a login form.

To fix this you will either have to enable SSL for your authoring system (which is recommended anyway) or put up with not using secure cookies.

MSDN: FormsAuthentication.RequireSSL Property

like image 144
Richard Seal Avatar answered Nov 14 '22 22:11

Richard Seal