There are a few PCs on LAN so I picked one and set it out as a gateway server, by running Squid on port 3128 (Ubuntu OS) then ran the following 2 commands on it:
echo 1 > /proc/sys/net/ipv4/ip_forward iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128
(and other PCs gateway dhcp ip are set to this Squid PC IP)
However, when other PCs browse to HTTP websites, the websites do not display but a Squid Error page display saying "The requested URL could not be retrieved" with the URL is : "/"
0 192.168.0.130 NONE/400 3522 GET / - HIER_NONE/- text/html
So I guess Squid could not read the hostname in the request.
Without the iptables command above, all other PCs can read websites fine and they are all working.
So it's not the gateway setup issue, but it's somewhere between iptables or Squid itself not understanding the request routed by iptables.
Was anyone in similar situation before? Any advise on where it went wrong would be really appreciated!!! Took me a day fiddling so far and no clue!!!