I fully understand that the recommended practice is simply to force the use of SSL throughout the site. However, there are certainly unique cases where the ability to choose and choose between HTTP and HTTPS can come in handy.
I came across a similar scenario like @Dsavid Gardner. My company uses a third-party provider to manage our part of the store on our site, and this store is located in the subdomain " https://store.mysite.com ". We have video content for 15 years, and our current video service provider breaks when the video is embedded in SSL. (I assume it draws resources from HTTP domains, but this is another problem the other day)
Of course, I could acquire SSL and go through the debugging process of two third-party providers, and also perform a search and replace on our entire database (or hhtaccess, but I was distracted) to correct any links to HTTP resources so that I could have a message in the header , say "Welcome" YourName ", but it just seems like a little redundant.
Here's a simple Javascript solution that I came across sets a workaround, insecure cookie based on secure cookies that are already set.
First I grabbed some javascript cookie functions . Go ahead and put this code in a secure part of your site:
function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)===' ') { c = c.substring(1,c.length); } if (c.indexOf(nameEQ) === 0) { return c.substring(nameEQ.length,c.length); } } return null; } function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+d.toUTCString(); document.cookie = cname + "=" + cvalue + "; " + expires + "; domain=.yourdomain.com"; } var firstNameCookie = readCookie("the-secure-cookie-name");
In this case, the only thing we leaked to our HTTP server is the name of the client. However, if you want even more security, you can set your server settings to allow access to certain cookies (ie, "firstNameCookie") via an HTTP request and adds an extra layer of protection. You can find out how to do it here.
Of course, this is not the most ideal solution. In the future I plan to implement an SSL site, but with a simple javascript function to replace it, however, it is nice to have.