Re: [squid-users] Squid as transparent proxy show squid error pages in browser

From: Frantisek Remias <fandaremail_at_gmail.com>
Date: Thu, 10 Jan 2013 09:38:15 +0100

Hello,
thank you for the response.

If I set the browser to use proxy a there is temporarily no internet
connection..then it shows the custom page (the ERR_DNS_FAIL one). BTW:
Is it possible to define another custom page when the internet
connection is not available (so it will shows different one when there
is DNS problem and another if internet connection is unavailable?)

If I dont set the browser to use proxy (meaning it will use
transparent mode proxy). It shows default browser error message like
"Internet Explorer cannot display the webpage" or "Server not
found...Firefox cant found the server at www.".... in firefox. What I
need is to show the squid custom page in this case there isnt internet
connection available

iptables rules
nat
-A POSTROUTING -s 192.168.2.0/24 -j MASQUERADE
-A PREROUTING -i hso0 -p tcp --dport 80 -j REDIRECT --to-port 3128
-A PREROUTING -i br0 -p tcp --dport 80 -j DNAT --to 192.168.2.254:3128
filter
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -j ACCEPT
-A INPUT -i br0 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A FORWARD -j ACCEPT
-A OUTPUT -j ACCEPT
-A OUTPUT -s 127.0.0.1/32 -j ACCEPT
-A OUTPUT -s 192.168.2.254/32 -j ACCEPT

2013/1/10 Amos Jeffries <squid3_at_treenet.co.nz>:
> On 10/01/2013 2:03 p.m., Frantisek Remias wrote:
>>
>> Hello,
>>
>> I need to show custom error page when site is unavailable. It works
>> good when I set browser to use proxy but not as transparent proxy
>> (shows default browser error message)
>
>
> You need to find out why the display is different. If the response from
> Squid is identical there is no reason to expect any difference in the
> browser behaviour there.
> So, what different response is Squid sending to the browser? with 3.1 the
> easiest way is to use the browsers developer tools (or the firebug plugin in
> Firefox).
>
>
>> Can it be done so it will show the custom error pages also as
>> transparent proxy? I have read to add some bypas iptables rules, but
>> I dont how exactly the rules should look like?
>
>
> bypass is to prevent the proxy receiving the requests. It has nothing to do
> with HTTP page content.
>
>
>> I am using debian Linux and squid 3.1.6
>>
>> Thank You
>
>
> Amos
Received on Thu Jan 10 2013 - 08:38:23 MST

This archive was generated by hypermail 2.2.0 : Thu Jan 10 2013 - 12:00:03 MST