Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid handling of arrayref results with redirects #2

Closed
berekuk opened this issue Jun 3, 2012 · 1 comment
Closed

Invalid handling of arrayref results with redirects #2

berekuk opened this issue Jun 3, 2012 · 1 comment

Comments

@berekuk
Copy link

berekuk commented Jun 3, 2012

If rules code returns arrayref with 3xx status, its location is ignored, usually resulting in infinite redirect.
Example:

use strict;
use warnings;

use Plack::Builder;

builder {
    enable 'Rewrite', rules => sub {
        return [ 302, [ Location => '/foo'], [] ] if /bar/;
    };
    sub {
        my $env = shift;
        return [200, [], [ "Path: $env->{PATH_INFO}" ] ];
    };
};

This app produces an infinite redirect if asked for /bar url.

PS: The reason I'm using it this way instead of substituting $_ and returning 302 is that I call external $app on different rules, and they handle some rewriting themselves.

@ap
Copy link
Owner

ap commented Jun 7, 2012

Thanks for the report. Fixed in 9e71965. Release 1.005 is winding its way to the CPAN, you should have it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants