Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Local links not working after nginx proxy_pass

$
0
0
I was trying to do some redirection with Nginx, was working fine with a simple rewrite, but it seems it did not meet the requirements. We need to hide the new address and keep the old. I read some documentation and was able to do it with the use of proxy_pass, but almost all the content of the new page is not loaded (css, images, local links not working, etc.)

I tried using the proxy_set_header to change some properties, but nothing I tried is working.

in my nginx.conf:

server {
server_name product.company.org;

location /rtd {
proxy_pass http://rtd.domain.company.com;
proxy_set_header Host $host;
}
}

When I enter 'product.company.org/rtd' in my browser, I see the main page on my Read the Docs server, but like I said, it's missing everything except the simple text...

I am in my main page 'product.company.org/rtd', I click on a link (which should be relative), the url of the link is: 'product.company.org/accounts/signup/'. The '/rtd/' is gone... If I write it manually in the address bar : 'product.company.org/rtd/accounts/signup/', the link works, but again, no css or images and links inside the page are not working.

Ideally, I would like to have several redirections:
http://product.company.org/rtd -> http://rtd.domain.company.com
http://product.company.org/foo -> http://foo.domain2.com
etc...

Is there a way to do want I am trying to do?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>