Beginner’s Guide to Proxy Servers
In this blog, we will learn to implement reverse proxy for NodeJS server
Proxy Server
Proxy is the server that sits in between a client and an actual server.
Type of Proxy servers
- Forward Proxy
Forward proxy configured on the client-side. A client makes a request to the server, instead of making a direct request to the actual server, it goes through a forward proxy server. A forward proxy will forward the request, Server gets a request, server response to the proxy. The proxy delivers that response to the client. The Source IP address of request will be the address of Proxy. The Source IP address is not visible on the server.
This means it acts like a VPN. So you can access restricted websites.
- Reverse Proxy
Reverse proxy configured on the server-side. A client makes a request to the server if a reverse proxy configured by the server. The request goes to the reverse proxy server. A client won’t know that request going to reverse proxy. The client will think, just sending a request to the server. Reverse Proxy will forward the request to the server.
DNS will return the address of the reverse proxy, not an actual server. It is really the opposite of forward proxy.
Revere proxy can be used as a load balancer, security shield, collect logs, etc.
Now implement all of these,
We will be using Nginx Proxy.
Download Nginx on Windows
http://nginx.org/en/download.html
We will be using a simple ExpressJS server.
Download Nginx files paste it into C: \ drive.
Configure the Nginx server for listening requests and forward it to the server.
In my case configure file located at
C:\Program Files\nginx-1.16.1\conf
Next step, Start Nginx server by running following command in the same directory where nginx.exe located
start nginx
To see the running task
tasklist /fi "imagename eq nginx.exe"
When making a request to port 80, it actually goes through Nginx proxy.
As you can see the header contents.
Now make a request to the server.
Now as you can see it directly requested to server.
Even Wappalyzer detects the Proxy server.