Hi. We have an application which supports both HTTP and HTTPS. If the user visits the site via https:// he should stay on that protocol and as such all links should be generated accordingly.
We do the SSL handling in Nginx in front of the bfg application. So the application always gets a request.application_url with a http:// link. We have an additional header "'HTTP_X_FORWARDED_PROTO" which gets sets to 'https'. In order to support this, we use our own route_url function that looks like this: from repoze.bfg.url import route_url as bfg_route_url def route_url(route_name, request, *elements, **kw): https = request.environ.get('HTTP_X_FORWARDED_PROTO') == 'https' value = bfg_route_url(route_name, request, *elements, **kw) if https: return value.replace('http://', 'https://') return value Does this sound like a reasonable approach, or is there a better alternative? Having to use a different implementation of a core API feels wrong. Thanks, Hanno _______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev