server { listen 80 default_server; server_name VILLASweb; # backend location location /api/ { proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # rewrite url to exclude /api on context broker side rewrite ^/api/?(.*) /api/$1 break; proxy_pass http://backend:4000/; } # frontend location location / { root /www; } # error pages error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; } error_page 500 502 503 504 50x.html; location = /50x.html { root /usr/share/nginx/html; } }