The real problem here is probably because Pylons server is only accepting HTTP connections and so wsgi.url_scheme in WSGi environment is always 'http' and doesn't reflect that a connection is originally being accepted by Apache as HTTPS.
For discussion of similar issue when nginx is used as proxy, accepting both HTTP and HTTPS, and with Apache/mod_wsgi behind but only accepting HTTP, see: http://groups.google.com/group/modwsgi/browse_frm/thread/94f952720c878506 In short, you need to have proxy front end pass some indication that HTTPS was used for original requests and use a WSGI middleware/ application wrapper check for that flag and reset wsgi.url_scheme to correct value based on how request was accepted by the proxy. Sure someone here can indicate best way of achieving this with Pylons. Graham On Dec 22, 9:36 pm, Andre Kolell <[email protected]> wrote: > I solved the problem regarding redirect_to and SSL by using mod_rewrite to > redirect each http-request to https: > > NameVirtualHost *:80 > > <virtualhost *:80> > RewriteEngine On > RewriteCond %{HTTPS} !=on > RewriteRule ^/(.*) https://%{SERVER_NAME}%{REQUEST_URI} [R] > </virtualhost> > > I'm not sure if this is an adequate solution. > > ----- Ursprüngliche Mail ----- > Von: "Andre Kolell" <[email protected]> > An: [email protected] > Gesendet: Freitag, 19. Dezember 2008 16:51:57 GMT +01:00 > Amsterdam/Berlin/Bern/Rom/Stockholm/Wien > Betreff: Problem with redirect_to and SSL > > Hello, > > I'm using Apache with SSL and use it's Proxy functionality to forward > requests to the local running Paster (with Pylons 0.9.7rc2). SSL and Links > work fine (with Mako). Only when Pylons comes to use the redirect_to-function > it always ends up in http- instead of https-Connections. Using > protocol='https' as a redirect_to-Parameter only solves my problem at first > view, but as I'm developing local without SSL, it's not really a solution. > > I also seems as if request.environ['wsgi.url_scheme'] gives me "http" instead > of "https". May be redirect_to uses request.environ['wsgi.url_scheme']? > > Does anyone know why redirect_to doesn't use SSL-Connections and how I can > make redirect_to using them? > > Best regards, > Andre --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
