Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

CGI::Application redirect not working

by shak380 (Novice)
on Mar 20, 2013 at 14:38 UTC ( #1024530=perlquestion: print w/replies, xml ) Need Help??
shak380 has asked for the wisdom of the Perl Monks concerning the following question:

In our CGI::Application code we have a redirect like this :
sub run_mode_xxx { return $self->header_props( -uri => $url ); }
It did not work on either Apache1 or Apache2. So I changed it like this :
sub run_mode_xxx { $self->header_add( -location => $url ); return; }
Now, it works on Apache2, but Apache1 shows "The document has moved here". We have tried with :
return $self->header_props( -uri => $url );
Still no luck. Any thoughts/fixes will be highly appreciated. Thanks

Replies are listed 'Best First'.
Re: CGI::Application redirect not working (cgi/nph)
by Anonymous Monk on Mar 20, 2013 at 15:54 UTC
Re: CGI::Application redirect not working
by sundialsvc4 (Abbot) on Mar 20, 2013 at 17:22 UTC

    The best way to debug problems like this is to look at it from the client side, using a debugger such as Firebug, the Developer menu in Safari, etc.   Look at the actual content of the HTTP message that is being sent and received in each case.   Now, locate a web-site that now does what you want it to do, and compare the two exchanges.   Now you know, not only what the Perl code you’ve written is actually doing, but what it needs to do.   This gives you a specific target to shoot for ... and if the perldocs don’t tell you, the source-code will.

Re: CGI::Application redirect not working
by saberworks (Curate) on Mar 20, 2013 at 23:57 UTC
    I have a redirect method in my CGI::Application base class that looks like this:
    sub redirect { my ($self, $location) = @_; $self->header_type('redirect'); $self->header_add(-location => $location); return; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1024530]
Front-paged by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2018-05-28 04:15 GMT
Find Nodes?
    Voting Booth?