Page 2 of 2

Re: Mixed content issue on stylesheet

Posted: Mon May 14, 2018 2:38 pm
by wiz
We're actually using HTTP_X_FORWARDED_PROTO in the Apache htaccess configuration for WonderCMS (also called "better security mode", which works on Apache only), it's the FRONT END HTTPS that was a total new thing to me.

Can you please give this a spin?
Included HTTP_X_FORWARDED_PROTO check and added multiple strtolower checks, as some servers may return "On" instead of "on", HTTPS instead of https, etc.

New modified fix (based on your fix):

Code: Select all

return 'http' . ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS'] == 'on')) || (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS'] == 'on')) || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . ((($_SERVER['SERVER_PORT'] == '80') || ($_SERVER['SERVER_PORT'] == '443')) ? '' : ':' . $_SERVER['SERVER_PORT']) . ((dirname($_SERVER['SCRIPT_NAME']) == '/') ? '' : dirname($_SERVER['SCRIPT_NAME'])) . '/' . $location;
For comparison, your fix:

Code: Select all

return 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && $_SERVER['HTTP_FRONT_END_HTTPS'] == 'on') ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . ((($_SERVER['SERVER_PORT'] == '80') || ($_SERVER['SERVER_PORT'] == '443')) ? '' : ':' . $_SERVER['SERVER_PORT']) . ((dirname($_SERVER['SCRIPT_NAME']) == '/') ? '' : dirname($_SERVER['SCRIPT_NAME'])) . '/' . $location;
And the last comparison, the original (currently in use in 2.5.1):

Code: Select all

return 'http' . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . ((($_SERVER['SERVER_PORT'] == '80') || ($_SERVER['SERVER_PORT'] == '443')) ? '' : ':' . $_SERVER['SERVER_PORT']) . ((dirname($_SERVER['SCRIPT_NAME']) == '/') ? '' : dirname($_SERVER['SCRIPT_NAME'])) . '/' . $location;
Since the above looks like something that will be included in the next version of WonderCMS, would you mind sharing your first name / last name + website link, so it can be included in the special contributors page (https://wondercms.com/special-contributors) and the release notes (https://wondercms.com/whatsnew)?

Re: Mixed content issue on stylesheet

Posted: Tue May 15, 2018 10:39 am
by snathan99
Tested the update and works great!

My information
First Name: Senthil
Last Name: Nathan
Website: https://realclearagent.net

Thanks so much for including in the update. Now I can update without having to edit it again.

Re: Mixed content issue on stylesheet

Posted: Wed May 16, 2018 1:54 pm
by wiz
The fix will be included in the update that's coming in the next couple of weeks. Even if you've modified your index.php, it will be overwritten with this fix once you update.

As a thank you, you've been added to the contributors page: https://wondercms.com/special-contributors
Once the update is live, you'll be also mentioned in the release notes: https://wondercms.com/whatsnew

Once again, thank you for the awesome discussion and for testing this out - marking thread solved.

Re: [SOLVED] Mixed content issue on stylesheet

Posted: Wed Jul 18, 2018 2:41 pm
by wiz
Hey snathan99, just letting you know that this fix has been deployed in the latest 2.5.2 version.

You've been also added to the release notes page: https://wondercms.com/whatsnew.