-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
Description
If the mopidy server is mounted in a subdirectory via a reverse proxy (e.g., https://domain/mydir, such that apps are available under https://domain/mydir/app), then the default websocket url in https://github.com/mopidy/mopidy.js/blob/master/src/mopidy.js#L65 points to the wrong location. Since the code already uses browserify (yey!), a solution is to use url.resolve() in order to determine the path:
var url = require("url");
var path = url.resolve(
(typeof document !== "undefined" && document.location.pathname) || "/",
"../mopidy/ws"
);and then
settings.webSocketUrl = settings.webSocketUrl ||
protocol + currentHost + path;In my setup, mopidy is mounted in a subdirectory via nginx and it took me a while to figure out why moped wasn't able to connect to the websocket. The above change would make it work without any further configuration.
What do you think?
Reactions are currently unavailable