I found that ``url(..., qualified=True)`` returns an http: URL even if
it's being served via an HTTPS proxy. This makes the URL invalid
because it refers neither to the proxy nor to the internal
PasteHTTPServer (i.e., it has the external port but the internal
protocol).
I then looked for an HTTPS-related variable in the request
environment, but there was one. Inklesspen on IRC said that this
depends on the proxy, and in Apache you'd have to set "RequestHeader
add HTTPS 1". I did that and could then set the protocol in my
controller:
protocol = request.environ.get("HTTP_HTTPS") and "https" or "http"
my_url = url(..., qualified=True, protocol=protocol)
This is not ideal on two levels:
1) The header should be automatically tied to SSL status rather than
having to be set separately.
2) url() should set HTTPS automatically.
Apparently in CGI the 'HTTPS' envvar would be set automatically, but
with proxy it isn't. There may be nothing we can do about it.
We also don't want to use the old singleton kludge to tell Routes
about the request. Still, I wonder if we can tell Routes another way,
such as a 'protocol' attribute on the mapper or to the URLGenerator
object.
Inklesspen also suggested a standard Pylons flag for https. Perhaps
``config['https']`` or ``config['pylons.https']``. If Pylons could
set this flag on startup, then controllers could use it.
--Mike Orr <[email protected]>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---