Fix: bind sendspin proxy to correct IP
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Tue, 17 Feb 2026 17:45:29 +0000 (18:45 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Tue, 17 Feb 2026 17:45:29 +0000 (18:45 +0100)
music_assistant/controllers/webserver/sendspin_proxy.py

index 2efe07dfdb1fac551a2b45ef901aa7210825c78d..5a66482cd779c27b89e4d3f37fef95abd56b11fe 100644 (file)
@@ -45,7 +45,12 @@ class SendspinProxyHandler:
     @property
     def internal_sendspin_url(self) -> str:
         """Return the internal sendspin URL for connecting to the internal Sendspin server."""
-        return f"ws://{self.mass.streams.publish_ip}:8927/sendspin"
+        # Connect via localhost since the proxy and Sendspin server run in the same process
+        # If the server binds to 0.0.0.0 (all interfaces), use localhost for efficiency
+        # Otherwise use the actual bind IP in case it's configured to a specific interface
+        bind_ip = self.mass.streams.bind_ip
+        connect_ip = "127.0.0.1" if bind_ip == "0.0.0.0" else bind_ip
+        return f"ws://{connect_ip}:8927/sendspin"
 
     async def handle_sendspin_proxy(self, request: web.Request) -> web.WebSocketResponse:
         """