CORS implemented in a static manner: unable to configure on another machine
This commit is contained in:
64
specs/008-deploy-to-hosting/quickstart.md
Normal file
64
specs/008-deploy-to-hosting/quickstart.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# Quickstart: Deploying to a Custom Host
|
||||
|
||||
This guide provides the steps to configure the application to run on a public-facing domain.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- A configured hosting environment with Docker and Docker Compose.
|
||||
- A public domain name pointing to your host.
|
||||
- (Optional) A reverse proxy (like Nginx or Traefik) to handle HTTPS/SSL termination.
|
||||
|
||||
## Configuration Steps
|
||||
|
||||
### 1. Backend Configuration
|
||||
|
||||
In the `backend/` directory, create a file named `.env`.
|
||||
|
||||
Add the following line to this file, replacing the URL with your **frontend's** public domain:
|
||||
|
||||
```
|
||||
CORS_ORIGIN=https://your-frontend-domain.com
|
||||
```
|
||||
|
||||
This tells the backend to accept API requests from your frontend application.
|
||||
|
||||
### 2. Frontend Configuration
|
||||
|
||||
In the `frontend/` directory, create a file named `.env`.
|
||||
|
||||
Add the following line to this file, replacing the URL with your **backend's** public API domain:
|
||||
|
||||
```
|
||||
REACT_APP_API_URL=https://api.your-domain.com
|
||||
```
|
||||
|
||||
This tells the frontend where to send its API requests.
|
||||
|
||||
### 3. Docker Compose Configuration
|
||||
|
||||
Modify the `docker-compose.yaml` file in the project root to pass these environment variables to the containers.
|
||||
|
||||
Update the `backend` and `frontend` services to include the `env_file` property:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
backend:
|
||||
# ... existing configuration ...
|
||||
env_file:
|
||||
- ./backend/.env
|
||||
|
||||
frontend:
|
||||
# ... existing configuration ...
|
||||
env_file:
|
||||
- ./frontend/.env
|
||||
```
|
||||
|
||||
### 4. Deployment
|
||||
|
||||
With the `.env` files in place and `docker-compose.yaml` updated, you can now build and run the application.
|
||||
|
||||
```bash
|
||||
docker-compose up --build -d
|
||||
```
|
||||
|
||||
The application should now be accessible at your public domain without CORS errors.
|
||||
Reference in New Issue
Block a user