Search code examples
djangodjango-adminproxypass

Hosting a django project behind proxypass


I have hosted to django admin project on a local machine X. http://10.4.x.y/myapp/admin works. I have an external IP on another machine Y and i am doing a proxy pass from the Y to X.

http://proxypassname.com/myapp/admin works. But, When i click the link "Save" or "Save continue editing" button after editing in admin page, it redirects to local machine ip (i.e. http://10.4.x.y/myapp/blah_blah_blah).

How to make sure that the django project redirects to proxypass name instead of local IP?


Solution

  • I did these two things and it worked.

    1. Whenever you add a ProxyPass, you should add ProxyPassReverse

    2. SITE_ID should be set to the domain where you want to point this django project.