-
-
Notifications
You must be signed in to change notification settings - Fork 34
Description
I'm currently trying to setup a couple of warriors using the official Docker images.
I wanted to host all of them behind one convenient domain like warriors.example.com/reddit/ using nginx as my reverse proxy.
This already works for the assets loaded but seems to break for the SockJS-Script.
It is requesting /info instead of /reddit/info in my case (same goes for /api/all-projects).
The problem seems to be at
seesaw-kit/seesaw/public/script.js
Line 2 in 2dc0bad
| var conn = new SockJS(window.location.protocol + '//' + window.location.host); |
and got introduces in fa11921.
I couldn't find any reason for SockJS getting a custom built URL in the first place instead of just providing the current URL. Maybe adding the current path or using the current full URL would work here as SockJS already preprocessed the given URL?
(var conn = new SockJS(window.location.protocol + '//' + window.location.host + window.location.pathname);)
seesaw-kit/seesaw/public/sockjs-0.3.js
Lines 300 to 320 in 699b0d2
| utils.amendUrl = function(url) { | |
| var dl = _document.location; | |
| if (!url) { | |
| throw new Error('Wrong url for SockJS'); | |
| } | |
| if (!utils.flatUrl(url)) { | |
| throw new Error('Only basic urls are supported in SockJS'); | |
| } | |
| // '//abc' --> 'http://abc' | |
| if (url.indexOf('//') === 0) { | |
| url = dl.protocol + url; | |
| } | |
| // '/abc' --> 'http://localhost:80/abc' | |
| if (url.indexOf('/') === 0) { | |
| url = dl.protocol + '//' + dl.host + url; | |
| } | |
| // strip trailing slashes | |
| url = url.replace(/[/]+$/,''); | |
| return url; | |
| }; |
To fix the /api routes it should be possible to just let the browser handle everything and calling a relative uri at
seesaw-kit/seesaw/public/script.js
Lines 274 to 306 in 2dc0bad
| function reloadProjectsTab() { | |
| $('#projects').load('/api/all-projects', null, function() { | |
| $("#projects input[type='submit']").each(makeButtonLink); | |
| $("#projects li").each(addProjectCountdown); | |
| }); | |
| } | |
| function reloadSettingsTab() { | |
| $('#settings-list').load('/api/settings'); | |
| } | |
| function reloadHelpTab() { | |
| $('#help').load('/api/help'); | |
| $('#broadcastMessage-indicator').hide(); | |
| if (localStorage) { | |
| localStorage.lastReadBroadcastMessageHash = currentBroadcastMessageHash; | |
| } | |
| } | |
| var warriorStatus = { | |
| 'UNINITIALIZED': ['The warrior could not contact HQ. Please reboot.', 'Shut down', '/api/stop'], | |
| 'NO_PROJECT': ['The warrior is idle. Select a project.', 'Shut down', '/api/stop'], | |
| 'INVALID_SETTINGS': ['You must configure the warrior.', 'Shut down', '/api/stop'], | |
| 'STOPPING_PROJECT': ['The warrior is stopping the current project.', 'Shut down', '/api/stop'], | |
| 'RESTARTING_PROJECT': ['The warrior is restarting the current project.', 'Shut down', '/api/stop'], | |
| 'RUNNING_PROJECT': ['The warrior is working on a project.', 'Shut down', '/api/stop'], | |
| 'SWITCHING_PROJECT': ['The warrior will switch to a different project.', 'Shut down', '/api/stop'], | |
| 'STARTING_PROJECT': ['The warrior is beginning work on a project.', 'Shut down', '/api/stop'], | |
| 'SHUTTING_DOWN': ['The warrior is stopping and shutting down.', 'Keep running', '/api/keep_running', | |
| 'Stop immediately', '/api/stop_now'], | |
| 'REBOOTING': ['The warrior is stopping and restarting.', 'Keep running', '/api/keep_running'] | |
| }; |