Avatar of ThorinO
ThorinO
Flag 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?
LinuxRoutersLinux Networking

Avatar of undefined
Last Comment
ThorinO

8/22/2022 - Mon
Craig Beck

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
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.
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.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Craig Beck

What version of Linux are you using?
ASKER CERTIFIED SOLUTION
crazedsanity

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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.