-
Notifications
You must be signed in to change notification settings - Fork 344
https for openshift #488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https for openshift #488
Conversation
Can you elaborate on what was broken on openshift because this fix breaks things for me. |
On openshift, the webserver doesn't set HTTPS header so the following condition doesn't return true: So, even when I opened my page using https, the generated base url would be prefixed with http. This would make all js, css, etc calls http. And browser would refuse to load them as they would appear to be unsecure. My change removes the protocol portion from base url. So, for example, if it was generating: Modern browsers handle the url having protocol prefix by using the procol from of current page. So, if you page is opened with https, the base url will be https as well. |
@niol which browser do you use? Could this be a problem with some or older browsers? Be aware that you can set the base url in your config.ini. I do this with my installation because the https proxy does also set the wrong $_SERVER values. |
I use Chromium 33 or Chrome 34. I noticed while investigating on the issue that I can set the base URL in config.ini, but I wanted to report that URL autodection had gone broken by that change (url redirection after login or logout for instance). Anyway can somebody who has access to an openshift deployment use print_r() to see all available server vars (and PHP environment) and fix the HTTPS test on openshift rather than removing that test that is usefull for other setups? |
I understand that config.ini can be used to override base url but I wanted the code to work without much config changes. The change has been working ok in my deployment. I can use print_r() but since I don't know PHP at all, I appreciate it if you could provide me with a snippet and tell me where to put it. |
This change breaks at least login and logout for me, as described in #513. |
@omer-akhter : A file with the following content would show you the vars available in PHP for selfoss to test if the request is using HTTPS. <?php
header('Content-type: text/plain');
echo "\$_SERVER: ";
print_r($_SERVER);
echo "\n\$_ENV: ";
print_r($_ENV);
?> If you see something we can use in the output, tell me. For instance on my setup, I have the following :
|
Here is what I got
|
Then |
Ok, I fixed this and made this part of code a bit more readable. |
I just updated to 2.9 and found out that https no longer works.
I did some digging and made some changes.