aboutsummaryrefslogtreecommitdiffstats
path: root/src/web
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2022-05-02 22:30:11 -0500
committerJP Dillingham <jpdillingham@gmail.com>2022-05-02 22:30:11 -0500
commita87cfb19040b102cc564107e3439e5f2b9a1a745 (patch)
tree5c5adc26e3ff5834baaee9b0a74d961deb30ed53 /src/web
parent35730a9445490fb8932df0b151ae6f6abd2cedc0 (diff)
downloadslskd-a87cfb19040b102cc564107e3439e5f2b9a1a745.tar.gz
fix routing
Diffstat (limited to 'src/web')
-rw-r--r--src/web/src/lib/api.js6
1 files changed, 5 insertions, 1 deletions
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)) {