[Catalyst] unexpected behavior of $c->request->secure and $c->request->base

Phil Mitchell phil.mitchell at pobox.com
Mon Apr 27 23:18:50 GMT 2009


On Mon, Apr 27, 2009 at 4:22 AM, Matt S Trout <dbix-class at trout.me.uk>wrote:

> I think either (a) we need more documentation explaining exactly how it
> makes its best guess so that it's more obvious to the people the guess is
> wrong for what's happening, or (b) we need (a) and some better guessing.
> Let's keep discussing how it could/should have guessed for your setup to
> find out which :)


For (b), I really don't know what could have been done for my setup --
non-standard port and (apparently) no env variable being set for HTTPS. Fyi,
the reason for the non-standard port is that I'm running both a dev and a
prod system on the same box using virtual hosts.

For (a) documentation, I took a stab at writing some. If this looks okay,
I'll submit a patch ...

>>UPDATED DOCS

 $req->base

Contains the URI base. This will always have a trailing slash. [ADDED:] Note
that the URI scheme (eg., http vs. https) must be determined through
heuristics; depending on your server configuration, it may be incorrect. See
$req->secure for more info.[END]

If your application was queried with the URI
http://localhost:3000/some/paththen base is
http://localhost:3000/.

 $req->secure

Returns true or false, indicating whether the connection is secure (https).
[ADDED] Note that the URI scheme (eg., http vs. https) must be determined
through heuristics, and therefore the reliablity of $req->secure will depend
on your server configuration. If you are serving secure pages on the
standard SSL port (443) and/or setting the HTTPS environment variable,
$req->secure should be valid. [END]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090427/11168=
e33/attachment.htm


More information about the Catalyst mailing list