Link to home
Start Free TrialLog in
Avatar of ThorinO
ThorinOFlag for United States of America

asked on

Can I use Squid be used to change the IP for a requested URL?

If domain.com (live) is 111.111.111.111 is it possible to configure squid so that when domain.com is requested it actually goes to 222.222.222.222 and maintain the host header?

If so can you please describe in detail (link) or config files?
Avatar of Craig Beck
Craig Beck
Flag of United Kingdom of Great Britain and Northern Ireland image

You could try adding an entry to the /etc/hosts file on the Squid box.

The file should be formatted as follows:

111.111.111.111 www.site1.com
222.222.222.222 www.site2.com
Avatar of ThorinO

ASKER

That is an good idea, I did not think of that, I wonder if it would be that easy. I will need to setup a Squid box and test. Will report back later.
Avatar of ThorinO

ASKER

Unfortunately it does not work, when I ping the domain from the console it returns the correct IP. However when connecting to the proxy using a browser I go to the incorrect IP.
What version of Linux are you using?
ASKER CERTIFIED SOLUTION
Avatar of crazedsanity
crazedsanity
Flag of United States of America 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
Avatar of ThorinO

ASKER

You are correct and I am almost there. The link you gave me got me on the right track but those configs are for v2 of Squid, I am currently using v3.1. The syntax can be found here: http://wiki.squid-cache.org/ConfigExamples/Reverse/MultipleWebservers

Now I need to configure it so it only allows what I have listed and denies everything else so people can't use it as a proxy for whatever they want. I also need to configure authentication so add additional security.