David K. Bainbridge
Committed by Simon Hunt

updated the base url handler to extract any app prefix from the absUrl in case o…

…nos is behind an app prefix

Change-Id: I271da533f39091efdd01d8104c1e6740effead52
(cherry picked from commit 3faa011d)
......@@ -34,8 +34,19 @@
}
function urlBase(protocol, port, host) {
// A little bit of funky here. It is possible that ONOS sits behind a proxy
// and has an app prefix, e.g. http://host:port/my/app/onos/ui... This bit
// of regex grabs everything after the host:port and before the uiContext
// (/onos/ui/) and uses that as an app prefix by inserting it back into
// the WS URL, if no prefix, then no insert.
var prefix = ""
if ($loc.absUrl) {
var p = $loc.absUrl().match(".*//[^/]+/(.+)"+uiContext);
prefix = p ? '/' + p[1] : '';
}
return matchSecure(protocol) + '://' +
(host || $loc.host()) + ':' + (port || $loc.port());
(host || $loc.host()) + ':' + (port || $loc.port()) + prefix;
}
function httpPrefix(suffix) {
......