30 lines
894 B
Nginx Configuration File
30 lines
894 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
|
|
# Path to the root of our single-page application
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
location / {
|
|
# First, try to serve the requested file ($uri),
|
|
# then a directory ($uri/),
|
|
# and if that fails, fall back to serving index.html.
|
|
# This is the key for making client-side routing work.
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Add a new location block to proxy API requests
|
|
location /api/ {
|
|
# Forward the request to the backend service.
|
|
# The name 'backend' is resolved by Docker's internal DNS.
|
|
proxy_pass http://backend:8080;
|
|
|
|
# Set headers to pass along client information to the backend
|
|
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;
|
|
}
|
|
}
|