custom nginx for proxi
This commit is contained in:
@@ -22,10 +22,7 @@ FROM nginx:stable-alpine AS runner
|
||||
# Copy build output
|
||||
COPY --from=builder /app/build /usr/share/nginx/html
|
||||
|
||||
# Optionnel : config nginx simple (si tu veux un fallback pour SPA)
|
||||
# Crée un fichier nginx.conf local et COPY-le ici si tu veux une config spécifique.
|
||||
# Exemple basique pour SPA (fallback to index.html)
|
||||
# COPY nginx-spa.conf /etc/nginx/conf.d/nginx-spa.conf
|
||||
COPY nginx-spa.conf /etc/nginx/conf.d/nginx-spa.conf
|
||||
|
||||
# Expose port 80 (Caddy fera reverse proxy)
|
||||
EXPOSE 80
|
||||
|
||||
22
nginx-spa.conf
Normal file
22
nginx-spa.conf
Normal file
@@ -0,0 +1,22 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Proxy API to backend container
|
||||
location /api/ {
|
||||
proxy_pass http://poster-picker-backend-1:5000/api/;
|
||||
proxy_http_version 1.1;
|
||||
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;
|
||||
}
|
||||
|
||||
# SPA fallback
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user