Beginner’s Guide to Proxy Servers

Prathamesh More
Analytics Vidhya
Published in
3 min readApr 19, 2020

--

In this blog, we will learn to implement reverse proxy for NodeJS server

Photo by Pakata Goh on Unsplash

Proxy Server

Proxy is the server that sits in between a client and an actual server.

proxy diagram
Proxy 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.

Forward proxy

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.

Reverse proxy

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.

Express Server

Download Nginx files paste it into C: \ drive.

Nginx Configuration

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"
Nginx server running

When making a request to port 80, it actually goes through Nginx proxy.

As you can see the header contents.

localhost:80/hi

Now make a request to the server.

localhost:4000/hi

Now as you can see it directly requested to server.

Even Wappalyzer detects the Proxy server.

Wappalyzer Chrome Extension

Thanks,

Stay home, stay safe.

Happy coding!

Feel free to contact

https://pprathameshmore.github.io/

--

--

Prathamesh More
Analytics Vidhya

Passionate, Self-taught Full Stack Web Developer that loves designing and building modern websites, applications, and APIs.