Re: [squid-users] url_rewrite_program issue

From: Eliezer Croitoru <eliezer_at_ngtech.co.il>
Date: Fri, 23 May 2014 18:00:56 +0300

Hey there,

I did not tested it since in the last month someone asked about a php
helper and I verified that php redirector\helper is the only language
which causes troubles with squid.

I would recommend you to use another language such as perl\python\ruby
or any other but not php.
(I will test the helper next week)

Eliezer

On 05/23/2014 01:08 PM, xan wrote:
> Goodmorning all,
> I'm pretty new to Squid and I would to make a simple url_rewrite_program.
> The problem is that although all seems to work fine, the rewrite doesn't
> work.
>
> Here my tiny squid.conf:
> /acl MyNetwork src 192.168.0.0/16
> http_access allow MyNetwork
> http_access deny all
> http_port 3128
> url_rewrite_program /etc/squid3/redirect.php/
>
> Here my tiny redirect.php:
> /#!/usr/bin/php
> <?php
>
> $temp = array();
>
> // Extend stream timeout to 24 hours
> stream_set_timeout(STDIN, 86400);
>
> $var = fopen("debug_php.txt","a+");
>
> while ( $input = fgets(STDIN) ) {
> // Split the output (space delimited) from squid into an array.
> $temp = split(' ', $input);
>
> // Set the URL from squid to a temporary holder.
> $output = $temp[0] . "\n";
> fwrite($var, $output);
>
> // Check the URL and rewrite it if it matches www.thisisawebsite.site
> if ( strpos($temp[0], "www.thisisawebsite.site") !== false ) {
> $output = "302:http://www.google.com/\n";
> }
> echo $output;
> }
> fclose($var);/
>
> (redirect.php found here:
> http://wiki.squid-cache.org/ConfigExamples/PhpRedirectors)
> So although I didn't get any kind of error on the squid.log the script
> doesn't rewrite. I forgot something?
> My Squid version is 3.3.8 and my PHP version is 5.5.9-1ubuntu4 (cli)
>
> I hope that someone can help me, thanks in advance.
> Kind regards.
> Xan
>
>
>
>
> --
> View this message in context: http://squid-web-proxy-cache.1019090.n4.nabble.com/url-rewrite-program-issue-tp4666083.html
> Sent from the Squid - Users mailing list archive at Nabble.com.
>
Received on Fri May 23 2014 - 15:02:25 MDT

This archive was generated by hypermail 2.2.0 : Fri May 23 2014 - 12:00:06 MDT