[Grok-dev] grok problems using https behind apache using mod_wsgi

Alexandre Garel alex.garel at tarentis.com
Thu Oct 25 07:36:55 UTC 2012


Le 09/10/2012 10:19, Päivi Rosenström a écrit :
> Hi!
>
> I'm beginner with grok and I try to set grok to run behind apache 
> using wsgi. I run into following problems.
>
> Application developed using grok runs smoothly with paster server.  I 
> also managed to get it run behind Apache with mod_wsgi while 
> connecting the application  using http.  But while attempting to 
> connect with https, the next click sets the protocol back to http. 
> This was with the configuration where application could have been used 
> either by http or https.

Hello,

I'm very late but I run in a similar problem yesterday. I am using 
mod_proxy but the trick may do with WSGI.

I simply wanted to deploy my application using Apache as a frontend to 
proxy paster. I also want Apache to handle https.

At my first attempt, server was responding but links and form actions 
were in http:// instead of https://

Finally I found PrefixMiddleware 
(http://pythonpaste.org/deploy/modules/config.html?highlight=https#paste.deploy.config.PrefixMiddleware). 
I add it as a filter to my application in paster deploy.ini and then ask 
Apache to add an |X-Forwarded-Scheme = https in request header.

the PrefixMiddleware in deploy.ini looks like :
|

|[filter-app:main]
use = egg:PasteDeploy#prefix
next = myapp
|


and the Apache configuration (with mod_proxy, mod_headers and mod_ssl):

|<virtualhost *:443>
   ServerName mydomain
   SSLEngine on

   SSLCertificateFile /path/to/certif.crt
   SSLCertificateKeyFile /path/to/certif.key
   ProxyPreserveHost On
   ProxyRequests Off
   RequestHeader set X-Forwarded-Scheme https

   ProxyPass / http://127.0.0.1:8083/
</virtualhost>
|



I think you can use same technique of |PrefixMiddleware + 
||X-Forwarded-Scheme| header in your mod_wsgi conifguration.

Hope this helps,

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.zope.org/pipermail/grok-dev/attachments/20121025/2d45e7f5/attachment.html>


More information about the Grok-dev mailing list