multi-scrobbler icon indicating copy to clipboard operation
multi-scrobbler copied to clipboard

Incorrect port when BASE_URL contains protocol's default port

Open pedorich-n opened this issue 8 months ago • 5 comments

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:

  1. 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
  2. The items.mainPort in the code mentioned above doesn't exist, so I ended up with http://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.

pedorich-n avatar Jun 04 '24 10:06 pedorich-n