perl - Squid 301/302 redirect failed? -


i new squid , want use it(squid 2.7) redirect, e.g. www.baidu.com --> www.google.com. enabled redirect module in squid using perl script:

#!/usr/bin/perl $|=1;     while (<>) {             @x = split;             $url = $x[0];             if ($url =~ /^http:\/\/www\.baidu\.com/) {                     print “302:https:\/\/www\.google\.com\n”;             }                 else {                     print “$url\n”;             }         } 

in squid.conf add:

rewrite_program /etc/squid/redirect.pl redirect_rewrites_host_header off redirect_children 20 

the client browser failed of accessing web page, checked packets on wire:

client --> proxy  http http://www.baidu.com/ http/1.1 proxy  --> client http http/1.0 301 moved permanently 

then client browser waited there no follow traffic.

anyone know reason?

and difference between redirect_program / url_rewrite_program / location_rewrite_program


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -