Link to home
Start Free TrialLog in
Avatar of pure032398
pure032398

asked on

Squid not checking hosts file? :(

Hello all.

  my squid caching program is not checking my /etc/hosts file and by default it should be :(  How can i please check / fix this?


*details*
I've modifed my /etc/hosts (as root) and added a score of ip's that point to localhost ... eg. image.ads.fairfax.com.au  127.0.0.1  so if the proxy is asked to get an something from image.ads.faifax.com.au then it try to find it on the local machine, instead of the real one.  This is a poor spam advertisment filter method ;)

If i ping image.ads.fairfax.com.au, it pings 127.0.0.1.
if i connect to there with netscape, no proxy, it connects to localhost (apache). If i turn proxy ON, in netscape, it connects to the real website.



Please help :(

I can list any /etc/squid/squid.conf or /etc/host* if this helps?

Also, i'm sure my bindings is Hosts, DNS, NIS+, NIS+. (but don't quote me on that becuase i'm not TOO sure if where i checked that is correct).

-PK-
ASKER CERTIFIED SOLUTION
Avatar of samri
samri
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
assuming that /etc/nsswitch.conf contains something like:
   hosts: files dns

As you describe the problem, I also assume that
   127.0.0.1  localhost
is top of your other aliases in /etc/hosts. Then I think it will be hard to aquire what you want, 'cause gethostbyname() would return the first name which matches.
I don't know how squid resolves hostnames, but I thing you need to pach it to get what you want.
Avatar of pure032398
pure032398

ASKER

thanks buddy.

after a hell of a lot mukng around as root, i got it working.

for some reason, my 3.2stable2 was installed in /usr/sbin/squid and /etc/squid/squid.conf

so i had lots of trouble doing a squid -z and squid -NCd1

and now my webmin doesn't report properly :(

but it runs.

(for now)

AND IT FILTERS THE SPAM ADDS! WOOT!

Thanks buddy

-PK-