Open KuroSetsuna29 opened 1 month ago
Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.
My current workaround is to add the following to my nginx reverse proxy to rewrite the response, but not ideal:
proxy_redirect http://speedtest.mydomain.com/ https://speedtest.mydomain.com:1443/;
proxy_redirect http://speedtest.mydomain.com:1443/ https://speedtest.mydomain.com:1443/;
proxy_redirect https://speedtest.mydomain.com/ https://speedtest.mydomain.com:1443/;
sub_filter "http://speedtest.mydomain.com/" "https://speedtest.mydomain.com:1443/";
sub_filter "http://speedtest.mydomain.com:1443/" "https://speedtest.mydomain.com:1443/";
sub_filter "https://speedtest.mydomain.com/" "https://speedtest.mydomain.com:1443/";
sub_filter "http:\/\/speedtest.mydomain.com\/" "https:\/\/speedtest.mydomain.com:1443\/";
sub_filter "http:\/\/speedtest.mydomain.com:1443\/" "https:\/\/speedtest.mydomain.com:1443\/";
sub_filter "https:\/\/speedtest.mydomain.com\/" "https:\/\/speedtest.mydomain.com:1443\/";
sub_filter_once off;
sub_filter_types *;
Edit: Added proxy_redirect
to fix redirects as well
We've somehow missed the APP_URL
setting from the readme, it needs to be set for nonstandard ports to the full URL (including port and protocol). e.g.
APP_URL=https://speedtest.mydomain.com:1443
I'll sort out a PR to update the readme.
@thespad Hmm, I just tried that and still getting the same behaviour
I put it both in docker environment variable and .env
in the config folder.
Looks like there's an upstream issue here https://github.com/alexjustesen/speedtest-tracker/issues/1673
Not going to fiddle with the image until there's a clear resolution from it, but might give you some ideas.
Interesting, so adding the ASSET_URL
fixed a different issue. Basically I can bypass the redirect issues if I go to the login page directly, ie. /admin/login
instead of going to /
which will try to redirect me to login but drop the port. But I then noticed a different problem where css/js/fonts were still not loading from correct hostname. Adding the ASSET_URL
seems to fix the css/js/font issue but the redirect is still taking me to the wrong port.
I don't think its entirely an upstream issue since the redirect works correctly going to the container by IP address, eg. http://192.168.1.1:8001/
(where I mapped docker port 8001:80). My guess is the X-Forwarded-Host
(or one of the http headers) is not being correctly forwarded to the application in the nginx configuration. So my reverse proxy is passing the custom X-Forwarded-Host
header, but then the nginx inside the container is discarding that and passing its own header value.
For now my workaround posted here works, so I guess I will continue to use that.
Thanks for taking a look.
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.
Is there an existing issue for this?
Current Behavior
When using a reverse proxy, such as nginx, to proxy pass to this container the application is loading resources and redirecting with incorrect host.
For example, my reverse proxy is running on https://speedtest.mydomain.com:1443/. Then when going to
https://speedtest.mydomain.com:1443/
, the application will redirect tohttps://speedtest.mydomain.com/admin/login
(note missing port).Expected Behavior
Going to
https://speedtest.mydomain.com:1443/
should correctly redirect tohttps://speedtest.mydomain.com:1443/admin/login
.Steps To Reproduce
Environment
CPU architecture
x86-64
Docker creation
Container logs