Linux – Redirected traffic with iptables to squid not displaying custom error page

iptableslinuxsquidtransparent-proxyUbuntu

I've created a squid configuration with the directive:

deny_info ERR_PROXY_INFO all

And tested this by setting squids port to 8080, then setting my browser proxy to 192.168.1.3:8080

This does display the custom error page.
But when I try to make it transparent with:

iptables -t nat -A PREROUTING -i br0 -p tcp --dport 80 -j REDIRECT --to-port 8080

It doesn't work and I get this browsing error:


ERROR

The requested URL could not be retrieved

Invalid Request error was encountered while trying to process the request:

GET / HTTP/1.1
Host: www.google.co.nz
Connection: keep-alive
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,/;q=0.5
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: XXX

Some possible problems are:

Missing or unknown request method.

Missing URL.

Missing HTTP Identifier (HTTP/1.0).

Request is too large.

Content-Length missing for POST or PUT requests.

Illegal character in hostname; underscores are not allowed.

Your cache administrator is webmaster.

Generated Tue, 28 Sep 2010 02:02:05 GMT by networkServer (squid/2.7.STABLE7)


Best Answer

Found the problem, I hadn't set up the transparent proxy correctly:

http_port 8080 ---> http_port 8080 transparent

How very n00b of me