Reputation: 290
How can I proxy an entire website from the backend to the frontend ? So far I can proxy to the index.html but sub requests for files needed by index.html are not proxied.
I have a frontend sending the requests to Nginx. It shall proxy the request to the backend, which has a generated website with html, js,css and json data. Frontend shall have the url /api. It shall proxy to the backend localhost:8080/swagger-ui/index.htm.
Now the index.html loads more files like the mentioned js, css and json files, but those requests like /api/swagger-ui/swagger.css all fail.
I tried a configuration according to this solution: NGINX Proxy to wordpress website But it still fails to load needed files like swagger-ui.css (with or without index index.html).
location ^~ /api {
proxy_pass http://localhost:8080/swagger-ui/index.html;
index index.html;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_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;
}
How can I proxy the entire backend website including the sub requests to the frontend ?
Upvotes: -1
Views: 25