server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Same-origin API calls from the SPA get forwarded to the backend # container by its compose service name -- the frontend never needs # to know a real hostname/port for the API, and there's no CORS to deal with. location /api/ { proxy_pass http://dota-random-web:8080/api/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location / { try_files $uri /index.html; } }