What is forward proxy?
From chatGPT:
A forward proxy is a type of server that acts as an intermediary between a client and the internet. When a client makes a request to access a website or online resource, the request is first sent to the forward proxy server. The proxy then forwards this request to the destination server, retrieves the response, and sends it back to the client.
- Go installed on your system. (Version
1.23.0
)
git clone git@github.com:chinmayagrawal775/forward_proxy.git
cd forward_proxy
go run main.go
Above command will run the proxy server at below URL:
By default it also starts the profiling server. You can access it at:
Run the below commands in new terminal
curl --proxy 127.0.0.1:6969 example.com
curl --proxy 127.0.0.1:6969 facebook.com
With the first commnad you will see the html output in your terminal.
And with the second command you will see Access to the site blocked!!
as facebook.com
is a blocked site in proxy server. You can tweak it by modifying the config/restricted-hosts.txt
file.
You can use the Makefile to create executable binary with the following command:
make build
Or you can also simply run the following command also:
go build
Both of the above commands will create the executable binaries with the name foraward_proxy
Here i am giving the example of using your proxy server in FireFox Browser. You can easily configure your firefox browser to use this forward proxy. Below are the steps to do that:
- Open Firefox, go to settings.
- In the General tab, at the very bottom, you will find the
Network Setting
section. Click theSettings...
button - Or you can also serach for
proxy
in the search bar of firefox settings - In the opened modal, click the
Manual proxy configuration
- Now you will have access to input the proxy URL.
- In HTTP proxy section enter the URL:
127.0.0.1
PORT:6969
- do check the
Also use this proxy for HTTPS
checkbox, so that HTTPs URLs will also be proxied. - Click on
OK
Hurray 🎉 🚀, Now you have cofigured the forward proxy in your firefox browser. All your request will now go through this proxy server. To verify check out the proxy server logs in terminal. You will find various requests logging there.