Invert if statement for https check, better compatibility#140
Invert if statement for https check, better compatibility#140mesa57 merged 1 commit intospotweb:masterfrom guyspr:master
Conversation
|
May I ask what webserver you use and if you use https ? |
|
The server which it is running on is using Apache and I am running on https. My https connection actually runs trough a proxy, which makes https to undefined instead of on. |
|
Ok. could you look at this issue : https://bugs.php.net/bug.php?id=66398 |
|
That issue basically describes my situation. Directly taken from phpinfo: X-Forwarded-HTTPS https So maybe adding a check for X-Forwarded-Proto == https is a better way around this issue. |
|
Thats what the topic suggests. But be aware that $_SERVER['X-FORWARDED-PROTO'] can be empty (as in my case without any proxy). |
|
Maybe HTTP_X_FORWARDED_SSL can be set? Function getRequestProtocol() 33920a2 has a check for this. Please correct me when I am wrong. 2016-04-05 19:38 GMT+02:00 mesa57 notifications@github.com:
Met vriendelijke groet, With kind regards, Mit freundlichen Grüßen, Distinti saluti, Atentos saludos, Jacco Onderdijk |
|
That function is not used anymore (?). Anyway, the proxy server is responsible for filling those variables. |
$settings['spotweburl'] = (@$_SERVER['HTTPS'] == 'on' || (@$_SERVER['HTTPS']== 'https')? 'https' : 'http') . '://' . @$_SERVER['HTTP_HOST'] . (dirname($_SERVER['PHP_SELF']) != '/' && dirname($_SERVER['PHP_SELF']) != '\\' ? dirname($_SERVER['PHP_SELF']). '/' : '/'); Just checked and my server actually sets |
|
As the documentation enhancement in the issue suggest the value $_SERVER['HTTPS'] will be non empty if called thu an https proxy. The value is not of importance. |
|
The documentation suggests it is either empty or off. (See the note) 'HTTPS' |
|
ISAPI filters are not often used. I am running an iis server without https and it is also returning 'off'. |
|
No reaction, going to merge. |
|
Reverting this due to some reported problems. |
|
And also here : http://gathering.tweakers.net/forum/view_message/46466721 |
|
Allright, I will have a look into a better way of handling this. Maybe as said before, using this statement should work pretty good: $settings['spotweburl'] = (@$_SERVER['HTTPS'] == 'on' || (@$_SERVER['HTTPS']== 'https')? 'https' : 'http') . '://' . @$_SERVER['HTTP_HOST'] . (dirname($_SERVER['PHP_SELF']) != '/' && dirname($_SERVER['PHP_SELF']) != '\\' ? dirname($_SERVER['PHP_SELF']). '/' : '/'); Here you are absolutely sure it is set to https, otherwise use http. Which would be a good flow of thoughts (in my opinion) |
I inverted the https check for compatibility. On some setups it happens that $_SERVER['HTTPS'] is undefined or nil if it is turned on, but it is set to 'off' when using http. (this was the case for me)
This needs testing on some different machines (which I don't have), to validate if this works on all systems.