refactor: consolidate public-web port to 8080 and add API proxy configuration
Remove backend port exposure and change public-web from port 8082 to 8080. Add backend dependency to public-web service. Remove public-web dependency from nginx service. Add /api/ location block to public-web nginx config with proxy_pass to backend:8080 and proxy headers for Host, X-Real-IP, X-Forwarded-For and X-Forwarded-Proto.
This commit is contained in:
@@ -23,8 +23,6 @@ services:
|
|||||||
- .env
|
- .env
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
ports:
|
|
||||||
- "8080:8080"
|
|
||||||
networks:
|
networks:
|
||||||
control:
|
control:
|
||||||
aliases:
|
aliases:
|
||||||
@@ -48,8 +46,10 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
dockerfile: public-web/Dockerfile
|
dockerfile: public-web/Dockerfile
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
ports:
|
ports:
|
||||||
- "8082:80"
|
- "8080:80"
|
||||||
networks:
|
networks:
|
||||||
- control
|
- control
|
||||||
|
|
||||||
@@ -58,7 +58,6 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
- admin-web
|
- admin-web
|
||||||
- public-web
|
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -4,6 +4,14 @@ server {
|
|||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://backend:8080;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri /index.html;
|
try_files $uri /index.html;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user