What is a reverse proxy?

A reverse proxy is an application that sits between the client (your users) and your origin servers and receives and responds to requests on your behalf. 

How a reverse proxy works

A reverse proxy is installed either on the same origin hosting your website or on a different server. When requests are sent to your origin, the reverse proxy acts as an intermediary. It looks at the request, and if the requested object is in cache, serves it to the client. If the requested object isn’t in cache, the reverse proxy forwards the request to your origin. It then caches the content from the response so that future requests can be served from cache.

Reverse Proxy vs Forward Proxy

As illustrated above, a reverse proxy sits between a client and a server. It accepts requests from clients and either returns the response as the origin server or sends the request to the origin before returning the response. A reverse proxy’s purpose is to protect the server by handling traffic and obscuring its identity.

A forward proxy, on the other hand, protects the client. A forward proxy sits in front of the client and the internet, and forwards requests and responses on behalf of the client. In this way, the client is able to obscure its identity and block unknown traffic.

Benefits of working with a reverse proxy

1. Caching

As mentioned above, a reverse proxy lets you store a copy of assets so that subsequent requests from any user can be delivered immediately without having to wait for them to be generated. Caching an already-generated asset means that a request for that asset can be responded to immediately without your origin server needing to do any extra work. This creates a faster experience for your users, and it saves you money because you won't need to pay for that traffic to your origin. Your origin will still need to handle some requests, but not as many. Additionally, a reverse proxy can compress HTTP data before sending the response, which also makes for faster delivery. 

2. Load Balancing

Another way a reverse proxy optimizes the response time is by balancing the demand for content. If your website has a surge in popularity and starts getting thousands of concurrent requests, this can overload your origin server and crash your website. By serving content from cache, you can prevent all of that traffic hitting your origin at once. If you have more than one source origin, the reverse proxy can distribute the requests across those servers. In the event your website does go down, users can still access the cached content, so they won’t have to experience any downtime. 

3. Security

Reverse proxies add an additional layer of security to protect your origin. Consider again the example above, where your website starts getting thousands of concurrent requests. What if they weren’t legitimate requests, but instead an attack on your website, like in a Distributed Denial of Service (DDoS) attack? Having a reverse proxy in place helps absorb the attack, preventing that malicious traffic from hitting your origin servers and taking down your website.

Can Fastly work as a reverse proxy?

A CDN service like Fastly is a reverse proxy but on a greater scale. Fastly’s CDN service consists of an entire network of cache servers, which we call points of presence, that sit between clients and your origin servers. The Fastly network comprises a large number of physical servers distributed all over the world, connected to the internet at high density internet exchange points. Each cache server in the network caches content from your origin and responds to requests from clients closest to them. 

Fastly's globally distributed network was built to absorb Distributed Denial of Service (DDoS) attacks. As part of Fastly's standard CDN service, all customers receive access to a combination of features inherent in Fastly Edge Cloud network that help protect the availability of your content from DDoS threats.

Fastly uses the Varnish Cache reverse proxy as an underlying architecture, which is not only fast but highly customizable. Our architecture enables you to cache all types of content including static, dynamic, and video content and programmatically purge when there are changes, letting you get the most out of the cache.

To learn more about how Fastly's CDN can help your business thrive, sign up for a free trial today.

Learn about Fastly CDN

Solicita una demostración