[Catalyst] Catalyst Redirect to https

Octavian Rasnita orasnita at gmail.com
Thu Mar 25 20:23:12 GMT 2010


Hi,

Sorry but I haven't provided the correct information.
The problem is that I use a load balancer (Apache mod_proxy_balancer) and it gets the https request, however it passes the request to the backend Apache - mod_perl based servers using http.

How do you do $c->res->redirect in cases like this?

The front end server listens to the ports 80 and 443 and the back end servers to the ports 81 and 82 (they are on the same machine for the moment).

The back end servers don't know if the current request is an http or an https one and on each redirect, they do the redirection using the http scheme.
(I have also set the configuration option using_frontend_proxy to true.)


Also, because the back end servers receive only http requests, $c->req->secure is always equal to 0.
I have read that I can set the HTTPS environment variable to "On" and I put the following line in the configuration file of the load balancer Apache server in the virtualhost that handles SSL requests:

SetEnv HTTPS On

But nothing changes and $c->req->secure is still equal to 0, and the redirects are still done using the https scheme, so I am doing something wrong for sure.

Do I need to have special virtualhosts on the back end servers that handle the requests that came using https and set the HTTPS environment variable on those virtualhosts? Or how can I let the Catalyst app know if the requests to the load balancer were using https?

Please tell me what should I do or where can I find more information about using a load balancer with https and Catalyst.

Thanks.

Octavian

From: "Christiaan Kras" <c.kras at pcc-online.net>
> You can use Catalyst::Plugin::RequireSSL to force https.
> 
> Although I think https should be used by your method if that's what the 
> user access the app with.
> 
> 
> Christiaan
> 
> 
> 
> Octavian Rasnita schreef:
>> Hi,
>>  
>> In a catalyst action accessed using https I do:
>>  
>> if ($c->authenticate({username => $username, password => $password, 
>> active => 1})) {
>>   $c->res->redirect($c->uri_for_action("/index"));
>> }
>> It redirects to / URI of the site, but using http, not https as in the 
>> request for the current page.
>>  
>> Isn't $c->uri_for_action() able to see that the current URI uses https 
>> and continue to use it or this revert to http is intentional?
>>  
>> Thanks.
>>  
>> --
>> Octavian
>>
>>
>> __________ Information from ESET NOD32 Antivirus, version of virus 
>> signature database 4973 (20100325) __________
>>
>> The message was checked by ESET NOD32 Antivirus.
>>
>> http://www.eset.com
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> List: Catalyst at lists.scsys.co.uk
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/
>>   
>


--------------------------------------------------------------------------------


> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>



More information about the Catalyst mailing list