Closed leonfilser closed 4 years ago
Hmm, I'm not sure if your change will work for proxy servers.
The difference between these two values is the following:
We add this to get the hostname of the proxy server, so it will work on ssl if the proxy server is different. We should test this change with someone who use a proxy server before we add this to the code.
Is there any progress on this? I would like to run Admidio in docker with Traefik as the reverse proxy also, and currently I can't login. Any known workarounds?
@sumnerboy12 Did the workaround also work for you?
I didn't try it sorry @Fasse. I was in the middle of migrating a whole load of self-hosted services to docker and didn't fancy having to do manual steps. I will try and give it a go in the next week or so if I find time, and report back.
@Fasse I can confirm the workaround is working for me also.
Ok, I will integrate this change to Admidio 4 and than we will see if users with proxy server have problems with this change within the beta phase.
So add this fix to Admidio 4 and referenced in the sourcecode to this issue. We will see if other environments still work.
I tested leonfilser's snippet and it worked flawlessly.
Edit: I stumbled upon a problem. Unfortunately your snippet seems to break my back-button.
When clicked, it redirected to:
https://admidio.samdyndns.de/admidio.samdyndns.de/adm_program/modules/dates/dates.php
When returning to the unmodified constants.php, the button now redirects to
https://8458d0f83616/admidio.samdyndns.de/adm_program/modules/dates/dates.php
I'll do some further digging.
if(isset($_SERVER['HTTP_X_FORWARDED_SERVER']) && $_SERVER['HTTP_X_FORWARDED_SERVER'] !== $_SERVER['HTTP_HOST'])
{
// if ssl proxy is used than this proxy is the host and the cookie must be set for this
//define('HOST', $_SERVER['HTTP_X_FORWARDED_SERVER'] . $port . '/' . $_SERVER['HTTP_HOST']); // ssl.example.org/my.domain.net
//This is what i am using:
define('HOST', $_SERVER['HTTP_HOST']); // ssl.example.org/my.domain.net
define('DOMAIN', strstr($_SERVER['HTTP_X_FORWARDED_SERVER'] . $port . ':', ':', true)); // ssl.example.org
}
I have to admit, that i don't really know what I'm doing, but i just removed "$_SERVER['HTTP_X_FORWARDED_SERVER']" and the port from the host constant. This did the trick.
This: https://admidio.samdyndns.de/admidio.samdyndns.de/adm_program/modules/dates/dates.php
Turned into this: https://admidio.samdyndns.de/adm_program/modules/dates/dates.php
Now also changed the condition check from
if (isset($_SERVER['HTTP_X_FORWARDED_SERVER']) && $_SERVER['HTTP_X_FORWARDED_SERVER'] !== $_SERVER['HTTP_HOST'])
to
if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && $_SERVER['HTTP_X_FORWARDED_HOST'] !== $_SERVER['HTTP_HOST'])
Hi! I am using Admidio in a Docker environment in combination with Traefik used as a reverse proxy. Everytime I try to login the following error appears:
English:
0efb778bedda. is the ID of my Traefik Container
I did a bit of debugging and found out that in admidio/adm_program/system/bootstrap/constants.php there is (probably) an issue on line 55-60
I replaced the Code with the following and it turned out to work
If you want to I can open a pull request to fix this