From 71485db4df548013e5f00b686e6b9ceb5494ffb2 Mon Sep 17 00:00:00 2001 From: jpellizzari Date: Wed, 11 Jan 2017 14:20:18 -0800 Subject: [PATCH] Removed leading slash from getAllNodes() api request --- client/app/scripts/utils/web-api-utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/app/scripts/utils/web-api-utils.js b/client/app/scripts/utils/web-api-utils.js index 3f1899c33d..15c063139f 100644 --- a/client/app/scripts/utils/web-api-utils.js +++ b/client/app/scripts/utils/web-api-utils.js @@ -1,5 +1,6 @@ import debug from 'debug'; import reqwest from 'reqwest'; +import trimStart from 'lodash/trimStart'; import { blurSearch, clearControlError, closeWebsocket, openWebsocket, receiveError, receiveApiDetails, receiveNodesDelta, receiveNodeDetails, receiveControlError, @@ -123,7 +124,9 @@ export function getAllNodes(getState, dispatch) { state.get('topologyUrlsById') .reduce((sequence, topologyUrl, topologyId) => sequence.then(() => { const optionsQuery = buildOptionsQuery(topologyOptions.get(topologyId)); - return fetch(`${topologyUrl}?${optionsQuery}`); + // Trim the leading slash from the url before requesting. + // This ensures that scope will request from the correct route if embedded in an iframe. + return fetch(`${trimStart(topologyUrl, '/')}?${optionsQuery}`); }) .then(response => response.json()) .then(json => dispatch(receiveNodesForTopology(json.nodes, topologyId))),