Install Squid as HTTP and HTTPS Proxy Server
While creating the vSearch 3.0, we needed a HTTP/HTTPS proxy server to test the new features like public cloud support. With a little search, I found the Squid server. It turned out to be pretty easy to install a new one and use it based on default settings.
Like most of the software package on CentOS, Squid can be installed using the yum command line. Here is what’s needed to install and configure it.
Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.
# yum -y update
# yum -y install squid
After installing the software, you can now verify with the squid command which will give you a long output in the console.
# squid -v
To run the service,
# systemctl start squid
To make sure the service starts every time the OS boots, you can type the following command.
# systemctl enable squid
By default, the proxy service runs on the port 3128 for both HTTP and HTTPS. Unless you want to change to a different port, you don’t need to configure anything.
To test out if Squid is working as expected, you can use a browser to give it a try. For me, I want to make sure the Squid is working perfectly before moving on testing our product.
With Firefox, you can open the Options by typing the “about:preferences” in the URL field. After clicking on the Advanced on the left side menu and then picking the Network tab on the main content, you will see the “Setttings…” button. In the “Connection Settings” dialog box, you will pick up the “Manual proxy configuration” and enter the IP address of the proxy server in the “HTTP proxy” field and 3128 as the port number. To make it simple, you can check the “Use this proxy server for all protocols.”
With Chrome, you can type in “chrome://settings/” in the URL field. On the page, you want to click on the “Show advanced settings…” at the bottom. Scroll down to the Network section and click on the “Change proxy settings…” button. That would bring up the “Internet Properties” dialog box. Continue to click on the “Settings” button to bring up another dialog box. In the Proxy server section, chech the “Use a proxy server for this connection (These settings will not apply to other connections). You can enter the address and port there and select “Bypass proxy server for local addresses.” If you want to configure different proxy servers for different protocol, you can click on the “Advanced” button.
The IE is pretty much the same as Chrome once you find the Network settings. Both Chrome and IE actually use the Windows sysstem settings. If if you change from one, the other should work automatically.
Troubleshooting Proxy Server
If the proxy does not work, you may want to first make sure the proxy itself can reach out to the Internet. If itself cannot, neither can it proxy others. That may involde poke a hole in your firewall so that the proxied protocols are allowed from this proxy IP address.
Secondly, you want to ping the proxy server from the browser computer. To avoid any DNS issue, you may want to use IP address of the proxy server instead of DNS name. If you have firewall on the proxy server, make sure the port 3128 is open to anyone.