From a87cfb19040b102cc564107e3439e5f2b9a1a745 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 2 May 2022 22:30:11 -0500 Subject: fix routing --- src/web/src/lib/api.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/web') diff --git a/src/web/src/lib/api.js b/src/web/src/lib/api.js index 73e75373..ef1fd31a 100644 --- a/src/web/src/lib/api.js +++ b/src/web/src/lib/api.js @@ -1,5 +1,5 @@ import axios from 'axios'; -import { baseUrl } from '../config'; +import { baseUrl, setUrlBase } from '../config'; import * as session from './session'; axios.defaults.baseURL = baseUrl; @@ -21,6 +21,10 @@ api.interceptors.request.use(config => { }); api.interceptors.response.use(response => { + // when behind a reverse proxy, we need the configured url base + // so that we can be explicit with react-router. every API response + // should contain this header, and it should be the same. + setUrlBase(response.headers['x-url-base']); return response; }, error => { if (error.response.status === 401 && !['/session', '/server', '/application'].includes(error.response.config.url)) { -- cgit v1.2.3