LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Squid problem (https://www.linuxquestions.org/questions/linux-software-2/squid-problem-4175487099/)

stamour547 12-06-2013 09:36 AM

Squid problem
 
Hi guys, I have a little problem here. I have been tasked with building out a squid proxy with the purpose of a web request coming in from the internet, hitting squid, and if the request is for a certain set of urls (we'll use example.com for example) gets translated. For example, if the request is for example.com, qquid would translate it to dev.example.com. Squid by itself works find but when I try to get a url_rewrite perl script to work I get the error message of squid[3286]: The store_rewriter helpers are crashing too rapidly, need help!

Here is the code from the perl script I am using (I don't know perl, I found this online and was changing the domain info myself).

#!/usr/bin/perl
use strict;

# Turn off buffering to STDOUT
$| = 1;

# Read from STDIN
while (<>) {

my @elems = split; # splits $_ on whitespace by default

# The URL is the first whitespace-separated element.
my $url = $elems[0];

# Handle foo.example.com links and translate them to bar.example.com
# with the rest of the URL intact (if present). Ignore warnings...
if ($url =~ m#^http://\.dev\.sendwordnow\.com(/.*)?#i) {

$url = "http://.dev.sendwordnow.local${1}";

print "$url\n";

}

# The last part, "(/.*)?", is redundant, but I added it because it might
# be useful to some. That part would be in $1 in this example.
elsif ($url =~ m#^http://\.sendwordnow\.com(/.*)?#i) {

# Redirect them to some intranet site...
$url = "http://\.dev.sendwordnow.local${1}";

print "$url\n";

}


}


else {

# Unmodified URL
print "$url\n";
}
}

Thank you in advanced.

Justin

Sydney 12-10-2013 08:05 AM

I do not know if this is your issue but you are escaping the first period in the URL below.
Code:

$url = "http://\.dev.sendwordnow.local${1}";
Translation would be
Code:

http://.dev.sendwordnow.local$


All times are GMT -5. The time now is 11:37 PM.