Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

use baseURI for websocket and api calls

puuu5bf725546be3
diff --git a/src-ui/src/app/services/consumer-status.service.ts b/src-ui/src/app/services/consumer-status.service.ts
index e03282175..4a729b29d 100644
--- a/src-ui/src/app/services/consumer-status.service.ts
+++ b/src-ui/src/app/services/consumer-status.service.ts
@@ -125,7 +125,7 @@ export class ConsumerStatusService {
connect() {
this.disconnect()
- this.statusWebSocket = new WebSocket(`${environment.webSocketProtocol}//${environment.webSocketHost}/ws/status/`);
+ this.statusWebSocket = new WebSocket(`${environment.webSocketProtocol}//${environment.webSocketHost}${environment.webSocketBaseUrl}status/`);
this.statusWebSocket.onmessage = (ev) => {
let statusMessage: WebsocketConsumerStatusMessage = JSON.parse(ev['data'])
diff --git a/src-ui/src/environments/environment.prod.ts b/src-ui/src/environments/environment.prod.ts
index b60824248..54c32d370 100644
--- a/src-ui/src/environments/environment.prod.ts
+++ b/src-ui/src/environments/environment.prod.ts
@@ -1,9 +1,12 @@
+const base_url = new URL(document.baseURI)
+
export const environment = {
production: true,
- apiBaseUrl: "/api/",
+ apiBaseUrl: document.baseURI + "api/",
apiVersion: "2",
appTitle: "Paperless-ng",
version: "1.4.2",
webSocketHost: window.location.host,
- webSocketProtocol: (window.location.protocol == "https:" ? "wss:" : "ws:")
+ webSocketProtocol: (window.location.protocol == "https:" ? "wss:" : "ws:"),
+ webSocketBaseUrl: base_url.pathname + "ws/",
};
diff --git a/src-ui/src/environments/environment.ts b/src-ui/src/environments/environment.ts
index 3d981b677..3b8a02e37 100644
--- a/src-ui/src/environments/environment.ts
+++ b/src-ui/src/environments/environment.ts
@@ -9,7 +9,8 @@ export const environment = {
appTitle: "Paperless-ng",
version: "DEVELOPMENT",
webSocketHost: "localhost:8000",
- webSocketProtocol: "ws:"
+ webSocketProtocol: "ws:",
+ webSocketBaseUrl: "/ws/",
};
/*