perl help

Igor Sysoev is at rambler-co.ru
Thu Feb 5 10:20:47 MSK 2009


On Thu, Feb 05, 2009 at 03:56:43PM +1030, Kingsley Foreman wrote:

> Hi guys,
> 
> I just need a quick hand with a rewrite rule im have issues with
> 
> i need to have a url like so
> http://blah.com/text.php?bitstart=21000
> 
> i need to use the bitstart=21200
> and using that to add the header
> Content-Range: 21200
> to a request before handing it of to a proxied site.
> 
> Of all things im having trouble getting bitstart=21200, in perl  to use it.

If you use 0.7.x:

        proxy_set_header  Content-Range  $arg_bitstart;

Other way is defining perl variable handler:

http {

    perl_set  $content_range '
        sub {
            my $r = shift;
            my $a = $r->args;
            if ($a =~ /bitstart=(\d+)/) {
                return $1;
            }
            return "";
       }';

       ...

           proxy_set_header  Content-Range  $content_range;


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list