Hey Berni, I was wondering to myself, why do you need to rewrite the url? Can't you just use a cache_peer and couple acls? Eliezer On 18/08/2015 16:43, Hicham Berni wrote:
Hi, We have a squid reverse configuration, and we need to change backend webserver with a new webserver with new IP and port (80 --> 8000) . Old squid configuration used url_rewrite_program. I 'not familar with this configuration. With port changing on new web server ( 80 --> 8000) , i find that i had to add new production web on url_rerite_program. I tried to change program , but i met a issue. on part 1 --> current rewrite program configuration running today and correctly for testurl --> running fine on part 2 --> configuration with change for testurl and productionurl -> OK for productionurl and KO for testurl An idea if something is wrong on change ? Part 1) old configuration : #!/usr/bin/perl $INTERNALIP="15.40.40.40"; $PRODUCTIONURL="add.ptr.lu"; $TESTURL="test.add.ptr.lu"; $TESTPORT="8001"; # turn off write buffering $| = 1; while (<>) { # get the URL from the request chomp($url = $_); if ($url =~ m/($INTERNALIP|$TESTURL):$TESTPORT/) { # fix up the cname and port $url =~ s^:$TESTPORT^^; $url =~ s^$INTERNALIP^$TESTURL^; # fix the protocol $url =~ s^https://^http://^; } else { # fix up the name $url =~ s^$INTERNALIP^$PRODUCTIONURL^; # fix the protocol $url =~ s^http://^https://^; } # return the fixed URL to squid print "$url\n"; } Part 2) configuration with changes #!/usr/bin/perl $INTERNALIP="15.40.40.40"; $PRODUCTIONURL="add.ptr.lu"; $TESTURL="test.add.ptr.lu"; $TESTPORT="8001"; $PRODPORT="8000"; # turn off write buffering $| = 1; while (<>) { # get the URL from the request chomp($url = $_); if ($url =~ m/($INTERNALIP|$TESTURL):$TESTPORT/) { # fix up the cname and port $url =~ s^:$TESTPORT^^; $url =~ s^$INTERNALIP^$TESTURL^; # fix the protocol $url =~ s^https://^http://^; } elsif ($url =~ m/($INTERNALIP|$PRODUCTIONURL):$PRODPORT/) { # fix up the cname and port $url =~ s^:$PRODPORT^^; $url =~ s^$INTERNALIP^$PRODURL^; # fix the protocol $url =~ s^https://^http://^; } else { # fix up the name $url =~ s^$INTERNALIP^$PRODUCTIONURL^; # fix the protocol $url =~ s^http://^https://^; } # return the fixed URL to squid print "$url\n"; } _______________________________________________ squid-users mailing list squid-users@xxxxxxxxxxxxxxxxxxxxx http://lists.squid-cache.org/listinfo/squid-users
_______________________________________________ squid-users mailing list squid-users@xxxxxxxxxxxxxxxxxxxxx http://lists.squid-cache.org/listinfo/squid-users