fix wrong base_url in reverse_proxy scenario to connect WSS#3855
fix wrong base_url in reverse_proxy scenario to connect WSS#3855nerzhul wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a configurable authentication callback URL so OAuth-style provider flows (e.g., Home Assistant) can redirect to a different externally reachable URL than the internally used base_url (useful behind reverse proxies / Kubernetes ingress).
Changes:
- Add
callback_urlsupport to the baseWebserverhelper and expose it via a new property. - Add a new
callback_urlconfig entry to the Webserver core controller and pass it into webserver startup. - Switch provider/auth redirect construction to use
callback_urlinstead ofbase_url.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
music_assistant/helpers/webserver.py |
Extends Webserver.setup and properties to include a callback URL. |
music_assistant/helpers/auth.py |
Uses the configured callback URL when generating auth session callback URLs. |
music_assistant/controllers/webserver/controller.py |
Adds callback_url to webserver config and startup wiring/logging. |
music_assistant/controllers/webserver/auth.py |
Uses callback URL for OAuth redirect URI generation. |
2359c9b to
8076433
Compare
|
Why did you not simply set the URL in the webserver configuration? |
|
@marcelveldt unfortunately it broke the websocket communication, for a reason i don't exaclty understand. I suspect that it don't listen anymore after that on the websocket, i got a 502 and it never recover until i remove the base_url from settings.json. |
8076433 to
942f0b8
Compare
marcelveldt
left a comment
There was a problem hiding this comment.
This change does not make sense as this is exactly why we have the setting for the base URL. So instead of introducing a duplicate config value, a user should just make sure that the base URL is correctly configured
Then we should instead fix that issue instead of adding a workaround. |
You're right, i was going the wrong way, let's try to find why in reverse proxy context with a DNS record the WS fail to connect to the backend. |
942f0b8 to
05614fd
Compare
|
ok i think i have the right fix, but i'm not able to build the image due do winedevine CDM, i hope the code is sufficient there |
If you are not using Apple Music during your test, you could simply temporarily comment out the widevine CDM part to build a docker image for testing on your k8s setup? |
thanks, let's try, cross compiling for ARM64 :) |
|
@MarvinSchenkel just tested it, it works very smoothly :) |
05614fd to
c3725a6
Compare
| CommandMessage, | ||
| ErrorResultMessage, | ||
| MessageType, | ||
| ServerInfoMessage, |
| # otherwise fall back to the configured base_url | ||
| server_info = self.mass.get_server_info() | ||
| if self.base_url: | ||
| server_info.base_url = self.base_url | ||
| await self._send_message(server_info) |
c3725a6 to
0796c06
Compare
|
Please undo your test changes to the docker files |
|
Marking this PR as draft so we can keep track of which PRs needs our attention. Please mark as 'Ready for review' when you want us to have another look 🙏 . |
0796c06 to
69913bb
Compare
There is a dynamic configuration to handle base_url but in handle_client we send the configured one and not the detected one
69913bb to
ca9928e
Compare
|
@marcelveldt rebased & removed my junk, my bad |
| server_info = self.mass.get_server_info() | ||
| if self.base_url: | ||
| server_info.base_url = self.base_url |
There was a problem hiding this comment.
Copilot has a good point here
|
i just identified this PR is not required anymore. I found the cullprint. This may required for some other things, but in my case it's not required anymore. |
In reverse proxy scenario, like in Kubernetes, music-assistant cannot be reached through websocket, we got a 502 after setting the base_url parameter.
There is a dynamic configuration to handle base_url but in WebsocketClientHandler::handle_client we send the configured one and not the detected one