status 301 changed to 200 only when deployed with fastcgi/lighty

View: New views
2 Messages — Rating Filter:   Alert me  

status 301 changed to 200 only when deployed with fastcgi/lighty

by Daniel McBrearty :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I finally deployed engoi.com live last night, after some protracted
bug fixing and stuff

One of the things I have in the site is a module which takes URL's for
the old site and sends back a status 301 with a redirect to the new
url for the same page.

For example: if the user requests

/public/index.cgm?natlang=nl

they get a 301 and redirect to

/nl/index.html

The code to do this looks (in part) like this;

my $r = "/$natlang/index.html";
$c->stash->{redirect} = $r;
$c->res->status( 301, $r );
$c->stash->{template} = '/redirect/redirect.tt';

And this works fine on the dev server.

WHen deployed with lighty/fastcgi, it also works fine - *except* that
the status code now becomes a '200'. My $c->res->status( 301, $r ) is
silently ignored.

My lighty deployment is basically a variation on this:

http://www.dev411.com/wiki/Installing_lighttpd_and_FastCGI_for_Catalyst

my lighttpd.conf section is a little different :

$HTTP["url"] !~ "\.(html|css|js|png|gif|ico)$" {
    fastcgi.server = (
        "" => ( "Engoi" => ( "socket" => "/tmp/engoi.socket",
                             "check-local" => "disable")
              ),
        ".cgm" => ( "Engoi" => ( "socket" => "/tmp/engoi.socket",
                             "check-local" => "disable")
              )
        )
}

Has anyone any idea why my status code should be silently changed?

thanks

Daniel



--
Daniel McBrearty
email : danielmcbrearty at gmail.com
http://www.engoi.com
http://danmcb.vox.com
http://danmcb.blogger.com
find me on linkedin and facebook
BTW : 0873928131

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: status 301 changed to 200 only when deployed with fastcgi/lighty

by Daniel McBrearty :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I resolved this by using the more usual

$c->res->redirect( $r, 301 );



On 9/24/07, Daniel McBrearty <danielmcbrearty@...> wrote:

> Hi
>
> I finally deployed engoi.com live last night, after some protracted
> bug fixing and stuff
>
> One of the things I have in the site is a module which takes URL's for
> the old site and sends back a status 301 with a redirect to the new
> url for the same page.
>
> For example: if the user requests
>
> /public/index.cgm?natlang=nl
>
> they get a 301 and redirect to
>
> /nl/index.html
>
> The code to do this looks (in part) like this;
>
> my $r = "/$natlang/index.html";
> $c->stash->{redirect} = $r;
> $c->res->status( 301, $r );
> $c->stash->{template} = '/redirect/redirect.tt';
>
> And this works fine on the dev server.
>
> WHen deployed with lighty/fastcgi, it also works fine - *except* that
> the status code now becomes a '200'. My $c->res->status( 301, $r ) is
> silently ignored.
>
> My lighty deployment is basically a variation on this:
>
> http://www.dev411.com/wiki/Installing_lighttpd_and_FastCGI_for_Catalyst
>
> my lighttpd.conf section is a little different :
>
> $HTTP["url"] !~ "\.(html|css|js|png|gif|ico)$" {
>     fastcgi.server = (
>         "" => ( "Engoi" => ( "socket" => "/tmp/engoi.socket",
>                              "check-local" => "disable")
>               ),
>         ".cgm" => ( "Engoi" => ( "socket" => "/tmp/engoi.socket",
>                              "check-local" => "disable")
>               )
>         )
> }
>
> Has anyone any idea why my status code should be silently changed?
>
> thanks
>
> Daniel
>
>
>
> --
> Daniel McBrearty
> email : danielmcbrearty at gmail.com
> http://www.engoi.com
> http://danmcb.vox.com
> http://danmcb.blogger.com
> find me on linkedin and facebook
> BTW : 0873928131
>


--
Daniel McBrearty
email : danielmcbrearty at gmail.com
http://www.engoi.com
http://danmcb.vox.com
http://danmcb.blogger.com
find me on linkedin and facebook
BTW : 0873928131

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/