-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
- I've read the guidelines for Contributing to YOURLS Projects
- This request isn't a duplicate of an existing issue
- I've read the docs and followed them (if applicable)
- This is not a personal support request that should be posted on the YOURLS Discourse community
Describe the bug
When running yourls in a Docker container, the redirect that takes place after authentication doesn't always work. Sometimes (and I haven't been able to pin this down precisely), the redirect is to http://localhost/admin instead of the correct site URL.
As far as I can tell, this is the only place where the yourls code references $_SERVER[SERVER_NAME] rather than YOURLS_SITE. Making that code change fixes the problem.
To Reproduce
-
Configure docker-yourls to run with
YOURLS_SITEset to "http://wibble:8002" and port mapping of8002:80. -
Configure Apache to listen on port 8000 and reverse-proxy to http://localhost:8002. This is deliberate because:
a) we need Apache to be proxying here and
b) we need Apache to listen on a non-standard port to cause the reply redirection to show as incorrect.
-
Navigate to http://localhost:8000/admin/. Enter valid credentials.
Expected behavior
What should happen is that yourls should return a redirection header of http://wibble:8002/admin/.
Actual behavior
The redirection header is to http://localhost/admin/ instead. Note that there is no port number.
Versions
1.7.6 running inside the yourls Docker container. No extensions or plugins.