I'm trying to rewrite all requests for my Django server running on apache+WSGI ( inside my local network) and configured as the WSGI's wiki how to, except that I set a virtualhost for it.

The server which from I want to rewrite requests is another apache server listening on port 80. I can manage it to work well if I don't try to enable SSL connection as the required way to connect. But I need all requests to Django server encrypted with SSL so I generally used this directive to achieve this ( on my public webserver ):

    Alias /dirname "/var/www/dirname"

        SSLVerifyClient      none
        SSLOptions           +FakeBasicAuth
        AuthName             "stuff name"
        AuthType             Basic
        AuthUserFile         /etc/httpd/djangoserver.passwd
        require              valid-user

        # redirect all request to django.test:80 
        RewriteEngine On
        RewriteRule   (.*)$  http://django.test/$1 [P]

This configuration works if I try to load a specific page trough the external server from my browser. It is not working clicking my django application urls ( even tough the url seems correct when I put my mouse over).

The url my public server is trying to serve use http ( instead of https ) and the directory "dirname" I specified on my apache configuration disappear, so it says that the page was not found. I think it depends on Django and its WSGI handler . Does anybody went trough my same problem?

PS: I have already tried to modify the WSGI script . I'm Using Django 1.0.3, Apache 2.2 on a Fedora10 (inside), Apache 2.2 on the public server.

Thanks in advance for your help.


  • See followups where you posted on Django user list. Oct 2, 2009 at 23:16

1 Answer 1


My solution thanks to Graham:

<Location /dirname>
    SSLVerifyClient      none
    SSLOptions           +FakeBasicAuth
    AuthName             "name Authentication"
    AuthType             Basic
    AuthUserFile         /etc/httpd/stuff.passwd
    require              valid-user

    RequestHeader set X-Url-Scheme https


ProxyPass /dirname http://django.test/dirname
ProxyPassReverse /dirname http://django.test/dirname

On django.test I added this :

 SetEnvIf X-Url-Scheme https HTTPS=1 


  WSGIScriptAlias /dirname /path_to_wsgi_script/django.wsgi 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .