Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
        SSLRequireSSL
        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.

Fab

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

1 Answer 1

My solution thanks to Graham:

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

    RequestHeader set X-Url-Scheme https


</Location>

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 

after

  WSGIScriptAlias /dirname /path_to_wsgi_script/django.wsgi 
share|improve this answer

Your Answer

 
discard

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.