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

ThorinO
ThorinO used Ask the Experts™
on
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?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2014

Commented:
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

Author

Commented:
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.

Author

Commented:
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.
Top Expert 2014

Commented:
What version of Linux are you using?
Sounds like you're trying to implement a reverse proxy: http://www.visolve.com/squid/whitepapers/reverseproxy.php

Author

Commented:
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.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial