Setting up Django application on lighttpd behind apache reverse proxy

Posted by ml256 on Server Fault See other posts from Server Fault or by ml256
Published on 2012-06-21T15:10:58Z Indexed on 2012/06/21 15:17 UTC
Read the original article Hit count: 197

Filed under:
|
|
|

I have a Django app at http://some_other_example.com (it will be behind firewall) running on lighttpd server with fastcgi.

I need make it available under http://example.com/myapp.

It works fine except for redirects - when I login from http://example.com/myapp/login it redirects me to http://example.com instead of http://example.com/myapp. When logging-in from http://some_other_example.com/login it is ok.

My configuration:

  • apache2.conf at example.com:

    ProxyPass /myapp http://some_other_example.com
    ProxyPassReverse /myapp http://some_other_example.com
    ProxyHTMLURLMap http://some_other_example.com /myapp
    <Location /myapp>
        SetOutputFilter proxy-html
        ProxyHTMLExtended On
        ProxyHTMLURLMap  /      /myapp/
    </Location>
    
  • in settings.py I added USE_X_FORWARDED_HOST = True but it didn't help

© Server Fault or respective owner

Related posts about apache2

Related posts about reverse-proxy