Given the following config:
server {
listen 80;
server_name site.com;
location /proxy {
proxy_pass http://newsite.com/;
}
}
The page hosted on site.com uses relative path (/main.css) for all it statics files, so when i receive the proxied page, the browser is querying static files with the wrong path:
i.e. : http://site.com/main.css
How would i go to have these static files requested follow to their original location (http://newsite.com/main.css)?
You should be able to use a rewrite rule in your
serversection, something like the following (untested):That should redirect all requests for .css files in the top-level directory of site.com to http://newsite.com/. Adjust the regex or add rewrite rules as necessary if you need to include other static files (images, scripts, etc.).