Blog URL identified as HTTPS by mistake – Solution
-
Hello,
I had a problem when the post links in my shares (all services) were always HTTPS links, although my blog is served via HTTP only (no SSL/TLS).
The only interesting thing about my setup I can think of is that I run my blog on IIS 8 on Windows 2012 R2.
I don’t know PHP really but I think I know where the error is and how to fix it.
In the file: OSDSocialShare.php
There is a line that looks like:
$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != '') ? "https://" : "https://";
I looked at StackOverflow, and found that this answer:
https://stackoverflow.com/a/2886224/146656I changed the code accordingly to be:
$isHttps = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443; $protocol = $isHttps? "https://" : "https://";
I’m guessing the key part is checking for ‘off’ not checking for
443
, but I didn’t test it to be honest.Can you please update the check to the one suggested here so other people don’t fall into the same problem?
Thanks a lot.
- The topic ‘Blog URL identified as HTTPS by mistake – Solution’ is closed to new replies.