1

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

3 Answers 3

2

Problem solved switching to Squid 2.7

1

I have a similar project called parentwall. I got around the issue by using squid -k reconfigure instead of restarting squid. You can do the same thing with the rc scripts.

Restarting squid takes forever and is unnecessary to reload the white list.

0

Just a thought, but it might be easier here to simply do a javascript redirect. So instead of trying to do a redirect with PHP simply return a page which has some javascript.

It is a bit less elegant, but it will probably be easier.

3
  • Javascript doesn't solve the problem. It is a squid bug documented here. Apr 27, 2011 at 22:06
  • Given the way I read that, it seems like javascript could solve the problem if you put a sufficient delay in place to allow for the squid reconfigure to complete. In any case, you should add an answer and mark that as accepted.
    – Zoredache
    Apr 27, 2011 at 22:44
  • The behavior is really strange. I've tried to put a delay in javascript as in php (1 minute) or print a link in the success page. The null bug appeared in both cases. Apr 28, 2011 at 7:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .