diff --git a/README.md b/README.md index b3a3743..3734a66 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,10 @@ docker-compose example in `dockercomposeexample` folder * `HTTPS` (`"yes"`/`"no"`) - whether the server enforce HTTPS or not +* `API_ROOT` + +* `WEB_ROOT` + ### Additional config options if you're not using docker * `DATA_DIR` - data directory for photos and uploaded files diff --git a/frontend/.proxyrc b/frontend/.proxyrc new file mode 100644 index 0000000..40218af --- /dev/null +++ b/frontend/.proxyrc @@ -0,0 +1,8 @@ +{ + "/api": { + "target": "http://localhost:3000/", + "pathRewrite": { + "^/api": "" + } + } +} diff --git a/frontend/src/env.ts b/frontend/src/env.ts index d9bd20a..407777f 100644 --- a/frontend/src/env.ts +++ b/frontend/src/env.ts @@ -1,12 +1,11 @@ export const apiRoot = process.env.API_ROOT || - process.env.NODE_ENV === "production" || - !process.env.NODE_ENV + (!process.env.NODE_ENV || process.env.NODE_ENV === "production" ? window.location.origin - : "http://localhost:3000"; + : process.env.NODE_ENV === "development" && + window.location.origin + "/api"); export const webRoot = process.env.WEB_ROOT || - process.env.NODE_ENV === "production" || - !process.env.NODE_ENV + (!process.env.NODE_ENV || process.env.NODE_ENV === "production" ? window.location.origin - : "http://localhost:1234"; + : "http://localhost:1234");