Skip to content

Commit b35206b

Browse files
authored
Merge pull request #29 from dotnetautor/change-api-url-for-reverse-proxy-use
Thanks @dotnetautor for this contribution! This is a great improvement for reverse proxy and SSL termination setups. 🎉
2 parents ffb63fe + 0c0e1a7 commit b35206b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

frontend/src/api.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import axios from 'axios';
22

3-
// Use the same host as the frontend (works for both localhost and LAN access)
4-
const API_BASE_URL = `http://${window.location.hostname}:8000`;
3+
// Use same origin for reverse proxy setups, fallback to :8000 for dev/Docker
4+
const API_BASE_URL = import.meta.env.DEV
5+
? `http://${window.location.hostname}:8000` // Dev mode: explicit port 8000
6+
: `${window.location.protocol}//${window.location.hostname}${window.location.port ? ':' + window.location.port : ''}`; // Production: same origin
57

68
export interface Job {
79
id: string;

0 commit comments

Comments
 (0)