Debian – Squid with whitelist and redirect

debianredirectsquidwhitelist

I managed to setup Squid3 on a Debian Squeeze 6.0 server in trasparent mode with iptables nat redirection.

All requests on port 80 are correctly redirected to squid and then compared with a whitelist file.

All requests to sites not covered by the whitelist are sent to the custom ERR_ACCESS_DENIED page. This page contains a simple login form.

So, when a site is blocked, the user has the ability to add that site to the whitelist.

I've created a very simple PHP script which takes the URL (with a regex), adds it to the whitelist and restarts squid.

At this point, i would to redirect the browser to the new authorized site, with a simple

$your_url = http://www.example.com;
header("Location: $your_url");

but squid gives me an ERR_INVALID_URL page trying to retrive

(null)://www.example.com

If I try to type the url in the address bar, the site is correctly served.

I've tried to set a timeout in PHP before redirect, but even with a 1 minute timeout, the redirect fails.
In the mean time, typing the url in the address bar works ok.

Any clue?

UPDATE Problem easly solved switching to Squid 2.7

Squid3 bug here

Best Answer

Problem solved switching to Squid 2.7

Related Topic