[Catalyst] Setting cookie_domain
catalyst2 at augensalat.de
Sun Apr 15 20:13:17 GMT 2007
On Sunday 15 April 2007 19:32, Fernan Aguero wrote:
> +----[ Bernhard Graf <catalyst2 at augensalat.de> (15.Apr.2007 08:23):
> | Hi,
> | I'm wondering how to set the cookie_domain of
> | Catalyst::Plugin::Session::State::Cookie when you run a site under
> | different domains.
> | The manual only gives advice how to do this in the (static)
> | configuration - and from looking at the source I get the impression
> | that I either had to sub class and override more or less
> | undocumented methods or otherwise had to patch.
> | Or is there a (better) third way?
> config your app using YAML. In your lib/app.pm file add
> 'ConfigLoader' to the list of plugins.
> The good thing about this setup is tat you can have a main
> config file and _local overrides for similar but not
> identical installations.
Thank you, but this doesn't help. Because I have only one application
that can be accessed under different domains (same 2nd-level domain
with TLDs .de, .at and .ch im my case).
The documentation for Catalyst::Plugin::Session::State::Cookie claims
that the default value for cookie_domain is the current host, which is
not true and probably would be counterproductive.
A sane default for cookie_domain would be something as
$cd = (/(\.[^\.]+\.[^\.]+)$/) || $_ for $c->req->uri->host
".example.com" for "www.example.com" and "www.sub.example.com",
"example.com" for "example.com" and of course
"mylocaltestdomain" for "mylocaltestdomain".
But this is untested yet.
More information about the Catalyst