[Catalyst] Catalyst Redirect to https
Jose Luis Martinez
jlmartinez-lists-catalyst at capside.com
Fri Mar 26 08:37:18 GMT 2010
El 26/03/2010 8:46, Octavian Rasnita escribió:
> And in a test action I have done:
> my $body;
> $body .= "HTTPS environment variable: $ENV{HTTPS}<br />\n";
> $body .= "HTTPS header: " . $c->req->header('HTTPS') . "<br />\n";
> $body .= "secure: " . $c->req->secure . "<br />\n";;
> $c->req->secure(1); #Force it to be true
> $body .= "secure: " . $c->req->secure . "<br />\n"; # Check if it is
> set correctly
> $body .= "uri_for_action: " . $c->uri_for_action('/user/login2') .
> "<br />\n";
> $c->res->body($body);
> And the result is:
> HTTPS environment variable: On
> HTTPS header: On
> secure: 0
> secure: 1
> uri_for_action: http://site.testsite.com:5555/en/user/login2
Try with
if (lc($c->req->headers()->{'x-https'}) eq 'on'){
my $uri = $c->req->base();
$uri->scheme("https");
$c->req->base($uri);
}
Note: I set X-Https header on the apache with
RequestHeader set X-Https "%{HTTPS}e"
works for me...
Jose Luis Martinez
jlmartinez at capside.com
More information about the Catalyst
mailing list