Skip to content

Commit 01cf5d0

Browse files
committed
docs: add explicit REACT_APP_TALAWA_URL examples for all scenarios
1 parent bbfbadc commit 01cf5d0

File tree

1 file changed

+11
-31
lines changed

1 file changed

+11
-31
lines changed

docs/docs/docs/getting-started/configuration.md

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,41 +48,21 @@ Add a custom port number for Talawa-Admin development purposes to the variable n
4848

4949
#### Setting up REACT_APP_TALAWA_URL in .env file
5050

51-
Add the endpoint for accessing talawa-api graphql service to the variable named `REACT_APP_TALAWA_URL` in the `.env` file.
51+
To connect the Admin panel to the API and avoid CORS issues, you only need to configure **one variable** in your `.env` file: `REACT_APP_TALAWA_URL`.
5252

53-
```
54-
REACT_APP_TALAWA_URL="http://API-IP-ADRESS:4000/graphql"
55-
56-
```
57-
58-
If you are a software developer working on your local system, then the URL would be:
59-
60-
```
61-
REACT_APP_TALAWA_URL="http://localhost:4000/graphql"
62-
63-
```
53+
The application will automatically handle the necessary proxy routing based on your environment.
6454

65-
If you are trying to access Talawa Admin from a remote host with the API URL containing `localhost`, You will have to change the API URL to
66-
67-
```
68-
REACT_APP_TALAWA_URL="http://YOUR-REMOTE-ADDRESS:4000/graphql"
69-
70-
```
71-
72-
#### Reverse Proxy Configuration (CORS Solution)
73-
To resolve CORS issues in production environments (where Admin and API run on different IPs), Talawa-Admin is designed to use a **Reverse Proxy**.
74-
75-
**1. React Configuration:**
76-
```bash
77-
REACT_APP_TALAWA_URL=/graphql
78-
REACT_APP_BACKEND_WEBSOCKET_URL=/graphql
79-
```
80-
**2. Web Server Configuration:**
81-
You must configure your web server (Nginx/Apache) to forward these `/graphql` requests to the actual API IP address.
55+
**Configuration Examples by Scenario:**
8256

83-
- **Docker**: The provided nginx.conf and apache.conf are pre-configured to forward to the internal api container.
57+
| Scenario | Deployment Type | API Location | `.env` Configuration | Notes |
58+
| :--- | :--- | :--- | :--- | :--- |
59+
| **1** | **Docker** | Same System (Localhost) | `REACT_APP_TALAWA_URL=http://localhost:4000/graphql` | The internal Nginx container handles the proxy automatically. |
60+
| **2** | **Docker** | Different Systems (Remote) | `REACT_APP_TALAWA_URL=http://<SERVER_IP>:4000/graphql` | Users access the Admin app via the Server IP. Nginx proxies requests internally. |
61+
| **3** | **Manual (Dev Mode)** | Same System (Localhost) | `REACT_APP_TALAWA_URL=http://localhost:4000/graphql` | The Vite dev server proxies requests to localhost:4000. |
62+
| **4** | **Manual (Dev Mode)** | Different Systems (Remote) | `REACT_APP_TALAWA_URL=http://<API_IP>:4000/graphql` | Set this to the IP of the machine running the API. Vite will proxy requests there. |
8463

85-
- **Distributed Systems:** If running on bare metal, update the proxy_pass directive in nginx.conf (or Apache equivalent) to point to your actual API IP Address.
64+
**Important for Manual Production Builds:**
65+
If you are deploying a production build manually without Docker, the Vite Dev Server is not active. You must configure your web server (Nginx or Apache) to forward requests from `/graphql` to your API URL, similar to the rules found in `config/docker/setup/`.
8666

8767
#### Setting up REACT_APP_BACKEND_WEBSOCKET_URL in .env file
8868

0 commit comments

Comments
 (0)