Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question
See followups where you posted on Django user list. – Graham Dumpleton Oct 2 '09 at 23:16
thanks, I will post the solution here – Lessfoe Oct 16 '09 at 13:56

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 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.