Django & Nginx deeplinking domains (re-write rules or django urls?)
-
19-09-2019 - |
Question
I'm running Django behind Nginx (as FASTCGI) and I need to "deeplink" to a page in one domain from the root of another without redirecting or forwarding e.g.
Given that I have a domain general-stuff.com and a matching URL http://general-stuff.com/books/ and that I have a second domain books-stuff.com I need a way to get the page served by http://general-stuff.com/books/ at the URL http://books-stuff.com/ how would I go about this?
Edit: Note that I also need the tree below these urls to work e.g. http://books-stuff.com/book1/ should serve the page at http://general-stuff.com/books/book1/ etc.
Thanks in advance
Richard.
Solution
You could use the proxy_pass
configuration in Ngxinx.
server {
gzip on;
listen 80;
server_name books-stuff.com ;
location / {
proxy_pass http://general-stuff.com/books/;
break;
}
}
Should do exactly what you want
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow