Re:Forcing Wordpress sites to use https even when not directed
by Cakez0r on Thursday July 23, 2015 @11:17AM
(#9936247)
Sounds more like a language issue.
https://secure.php.net/manual/en/reserved.variables.server.p...
[ Parent
| on HN ]
Re:Forcing Wordpress sites to use https even when not directed
by TazeTSchnitzel on Thursday July 23, 2015 @12:54PM
(#9936964)
That's not an issue with PHP itself. $_SERVER maps directly to CGI variables (or equivalents provided by the web server in non-CGI environments).
Re:Forcing Wordpress sites to use https even when not directed
by detaro on Thursday July 23, 2015 @11:21AM
(#9936272)
But then the environments violate that specification if they set this variable off a random HTTP header?
Re:Forcing Wordpress sites to use https even when not directed
by Cakez0r on Thursday July 23, 2015 @11:24AM
(#9936304)
If the language spec says that $_SERVER['HTTPS'] is an indicator of whether the request was made over HTTPS, then it should ensure that it adheres to its own spec (I.E. not overwrite $_SERVER['HTTPS'] with the value from a header, if it's present).
Re:Forcing Wordpress sites to use https even when not directed
by nolok on Thursday July 23, 2015 @12:10PM
(#9936656)
It does. The problem is in Apache, not the language.
Apache's says to look into the HTTPS variable (that it adds itself before passing the call to the handler) to know if the call was made over https, but then it overwrite that variable with the browser-sent header if there is one (or more exactly, it uses the same variable name for that header and it's own HTTPS indicator; so it overwrites if both are present, and if only the header is present then it creates it when it shouldn't -- the issue in this post).