Commit 10e66af
authored
feat(docker): make reverse proxy optional with ENABLE_PROXY flag (#9)
## Summary
- Makes the reverse proxy behavior optional in the web container
- By default, the browser now connects directly to the API (no reverse
proxy)
- Set `ENABLE_PROXY=true` to use nginx as a reverse proxy (previous
behavior)
## Changes
- Add `ENABLE_PROXY` environment variable (default: `false`)
- In direct mode: `config.json` contains the full `API_URL`
- In proxy mode: `config.json` contains `/api/v1` (relative path)
- Use dynamic DNS resolver extracted from `/etc/resolv.conf` for nginx
- Fix `config.json` file permissions (644) so nginx can read it
- Update `docker-compose.yaml` to set `ENABLE_PROXY=true`
## Usage
**Direct mode (default):**
```bash
docker run -e API_URL=https://api.example.com dispatchoor-web
# config.json: {"apiUrl": "https://api.example.com/api/v1"}
```
**Reverse proxy mode:**
```bash
docker run -e API_URL=http://api:9090 -e ENABLE_PROXY=true dispatchoor-web
# config.json: {"apiUrl": "/api/v1"}
```
## Test plan
- [x] Build image: `make docker-build-web`
- [x] Test direct mode: verify `config.json` contains full API URL
- [x] Test proxy mode: verify `config.json` contains `/api/v1`
- [x] Verify nginx starts without upstream resolution errors
- [x] Verify `config.json` is accessible (not 403)1 parent 1e63a2e commit 10e66af
2 files changed
+40
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
37 | | - | |
| 44 | + | |
38 | 45 | | |
39 | | - | |
| 46 | + | |
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
| |||
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
51 | | - | |
| 58 | + | |
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
55 | 62 | | |
56 | | - | |
| 63 | + | |
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
| |||
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
77 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
78 | 93 | | |
79 | 94 | | |
80 | 95 | | |
81 | 96 | | |
82 | 97 | | |
83 | | - | |
84 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
85 | 109 | | |
86 | | - | |
| 110 | + | |
87 | 111 | | |
88 | | - | |
89 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
90 | 115 | | |
91 | 116 | | |
92 | 117 | | |
93 | 118 | | |
94 | | - | |
95 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
96 | 123 | | |
97 | 124 | | |
98 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
0 commit comments