Configure CORS origins and backend port
This commit is contained in:
20
README.md
20
README.md
@@ -116,6 +116,8 @@ POSTGRES_DB=plasttrack
|
||||
POSTGRES_USER=plasttrack
|
||||
POSTGRES_PASSWORD=change-this-password
|
||||
FRONTEND_ORIGIN=http://SERVER_IP:5173
|
||||
FRONTEND_ORIGINS=http://SERVER_IP:5173,http://localhost:5173,http://127.0.0.1:5173
|
||||
BACKEND_PORT=8000
|
||||
VITE_API_BASE_URL=http://SERVER_IP:8000
|
||||
VITE_WS_URL=ws://SERVER_IP:8000/ws/dashboard
|
||||
VITE_ALLOWED_HOSTS=SERVER_IP,localhost,127.0.0.1
|
||||
@@ -128,6 +130,8 @@ POSTGRES_DB=plasttrack
|
||||
POSTGRES_USER=plasttrack
|
||||
POSTGRES_PASSWORD=change-this-password
|
||||
FRONTEND_ORIGIN=https://plasttrack.example.com
|
||||
FRONTEND_ORIGINS=https://plasttrack.example.com
|
||||
BACKEND_PORT=8000
|
||||
VITE_API_BASE_URL=https://api.plasttrack.example.com
|
||||
VITE_WS_URL=wss://api.plasttrack.example.com/ws/dashboard
|
||||
VITE_ALLOWED_HOSTS=plasttrack.example.com
|
||||
@@ -140,6 +144,22 @@ machine, not the Docker host.
|
||||
If Vite returns `Blocked request. This host is not allowed`, add the public
|
||||
frontend host to `VITE_ALLOWED_HOSTS` as a comma-separated value.
|
||||
|
||||
If the backend host port conflicts with another service such as Portainer,
|
||||
change `BACKEND_PORT` instead of editing `docker-compose.yml`. For example:
|
||||
|
||||
```env
|
||||
BACKEND_PORT=8001
|
||||
VITE_API_BASE_URL=http://SERVER_IP:8001
|
||||
VITE_WS_URL=ws://SERVER_IP:8001/ws/dashboard
|
||||
```
|
||||
|
||||
If the browser shows a CORS error, make sure the exact frontend origin is in
|
||||
`FRONTEND_ORIGINS`. Example:
|
||||
|
||||
```env
|
||||
FRONTEND_ORIGINS=https://plasttrack.sable.ynsdev.site
|
||||
```
|
||||
|
||||
### 3. Deploy
|
||||
|
||||
Click `Deploy the stack`.
|
||||
|
||||
Reference in New Issue
Block a user