multi-scrobbler
multi-scrobbler copied to clipboard
Incorrect port when BASE_URL contains protocol's default port
Describe the bug
I am running the multi-scrobbler
behind the reverse proxy on the address http://multi-scrobbler.server.lan
and specify the same address in BASE_URL
(also tried http://multi-scrobbler.server.lan:80
).
Two issues arise:
- Because URL trims the default protocol's port (80 for HTTP and 443 for HTTPS), MS assumes I didn't specify the port and tries to use its default port for the base url instead. Which is not correct in my case: https://github.com/FoxxMD/multi-scrobbler/blob/0dcd049453fcbb0e8cadfe8978f5d822b069ce1d/src/backend/ioc.ts#L74-L79
- The
items.mainPort
in the code mentioned above doesn't exist, so I ended up withhttp://multi-scrobbler.server.lan:undefined
as a base url for redirects. Looks like this commit caused this issue.
Expected behavior Use the default port when specified.
Logs
[App] [API] User-defined base URL for UI and redirect URLs (spotify, deezer, lastfm): http://multi-scrobbler.server.lan:undefined
Versions (please complete the following information):
- multi-scrobbler: 0.7.1, docker
Additional context
The port gets lost after normalization because the normalize-url
also uses URL
.
I think the code should either assume the port is 80 when not specified, as it seems to be the behavior of URL
, or at least respect the explicitly specified port even when it's the default.
The current workaround for me is to explicitly specify the redirect URLs for sources.