Hi,
There are some posts in the forum talking about issues related with “reverse proxy”. IMHO, with Cloud and docker this will be a more and common scenario so I think we need a solution for this.
To take the whole picture, those are some examples:
- OJS 3 behind reverse proxy - how to achieve? - #17 by D_Schroeder_Micheel
- Error installing OJS 3.1.1.0 - #6 by Cesar_soto
- OAI baseURL does not corresponding with URL - #7 by Juan_Pablo_Giron_Rui
- [OJS3] File uploads blocked in reverse proxy setup with enforced HTTPS
I though was fair continue talking about this problem here because this post is one of the most recent, well explained and include a fix that just need to be implemented (patch posted here is not generic enough).
Although I agree with Clinton with this:
This will not be possible/feasible/desirable/comfortable in some scenarios and (please correct me) I think the problem here is that OJS is not working as it should.
IMHO (and I have a limited perspective) OJS is asking about the protocol to SCRIPT_URI, when it need to honor the protocol specified at HTTP_X_FORWARDED_PROTO (if exists).
As published before in this thread typo3 are also dealing with similar issues and they fixed it the way specified:
https://forge.typo3.org/issues/29693
Tomorrow I will also dig into Drupal and Wordpress to be sure we are moving in the same direction, but if you agree, I can make a PR for 3.2 and 3.3 to fix this issue and make “reverse-proxiers” life easier.
The patch is as simple as adding a condition here:
To check if HTTP_X_FORWARDED_PROTO exists, and if yes, set the protocol to be whatever you find in the variable.
Waiting for your comments,
m.