Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Changes between Version 4 and Version 5 of RedirectHttpsRequests


Ignore:
Timestamp:
03/05/06 09:19:17 (13 years ago)
Author:
godoy
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RedirectHttpsRequests

    v4 v5  
    106106 
    107107In the long run, it would be better if !CherryPy were able to listen on two different ports for requests.  If we could configure the ports to have different base urls, it would make processing redirects much easier.  It looks like this may be possible to do in upcoming versions of TurboGears. 
     108 
     109= Solving the problem with Apache = 
     110 
     111Using Apache you configure it normally to listen on whatever port you'd like to have it.  And code your !TurboGears code normally, as if it was all local.  Using any of cherrypy.!HTTPRedirect or turbogears.redirect work the same way.  
     112 
     113To achieve that you just need to put in your server (if you're only serving one website in one port) or virtual host (if you're serving more websites, mixing technologies such as !TurboGears and Zope, using both HTTP and HTTPS, etc.) the following lines: 
     114 
     115{{{ 
     116ProxyPass /root_of_site http://localhost:8080/ 
     117ProxyPassReverse /root_of_site http://localhost:8080/ 
     118}}} 
     119 
     120If your newly developed !TurboGears site is the root of your HTTPS website, then those lines would become: 
     121 
     122{{{ 
     123<VirtualHost hostname:443> 
     124  # Several common Apache configurations for servername, certificate, etc. 
     125 
     126  # Let the magic begin! 
     127  ProxyPass / http://localhost:8080/ 
     128  ProxyPassReverse / http://localhost:8080/ 
     129</VirtualHost> 
     130}}} 
     131 
     132!ProxyPass takes care of passing the request on the SSL-encrypted port to the local 8080 port where !CherryPy is listening.  Then, !ProxyPassReverse takes care that everything coming back from !CherryPy references the public website. 
     133 
     134I've been using these without any new filter or change to headers and with a lot of turbogears.redirects inside the code.  I've also found that using Apache makes the site more responsive than using Pound, I believe it is due cache.