<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Le 09/10/2012 10:19, Päivi Rosenström a
      écrit :<br>
    </div>
    <blockquote
      cite="mid:20121009111919.95465zx3cp0rxq87.psiivola@webmail.helsinki.fi"
      type="cite">Hi!
      <br>
      <br>
      I'm beginner with grok and I try to set grok to run behind apache
      using wsgi. I run into following problems.
      <br>
      <br>
      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.
      <br>
    </blockquote>
    <br>
    Hello,<br>
    <br>
    I'm very late but I run in a similar problem yesterday. I am using
    mod_proxy but the trick may do with WSGI.<br>
    <br>
    I simply wanted to deploy my application using Apache as a frontend
    to proxy paster. I also want Apache to handle https.<br>
    <br>
    At my first attempt, server was responding but links and form
    actions were in <a class="moz-txt-link-freetext" href="http://">http://</a> instead of <a class="moz-txt-link-freetext" href="https://">https://</a><br>
    <br>
    Finally I found PrefixMiddleware
    (<a class="moz-txt-link-freetext" href="http://pythonpaste.org/deploy/modules/config.html?highlight=https#paste.deploy.config.PrefixMiddleware">http://pythonpaste.org/deploy/modules/config.html?highlight=https#paste.deploy.config.PrefixMiddleware</a>).
    I add it as a filter to my application in paster deploy.ini and then
    ask Apache to add an <code>X-Forwarded-Scheme = https in request
      header.<br>
      <br>
      the PrefixMiddleware in deploy.ini looks like :<br>
    </code><br>
    <pre><code class="">[filter-app:main]
use = egg:PasteDeploy#prefix
next = myapp
</code></pre>
    <br>
    and the Apache configuration (with mod_proxy, mod_headers and
    mod_ssl):<br>
    <pre><code class="">&lt;virtualhost *:443&gt;
  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 / <a class="moz-txt-link-freetext" href="http://127.0.0.1:8083/">http://127.0.0.1:8083/</a>
&lt;/virtualhost&gt;
</code></pre>
    <br>
    <br>
    I think you can use same technique of  <code>PrefixMiddleware + </code><code
      class="">X-Forwarded-Scheme</code>
    header in your mod_wsgi conifguration.<br>
    <br>
    Hope this helps,<br>
    <br>
    Alex
  </body>
</html>