Video in progress
What is the difference between a reverse proxy and a forward proxy?
A forward proxy sits on the client side and goes out to the internet on behalf of clients — the server doesn't see the real client. A reverse proxy sits on the server side and accepts requests on behalf of servers — the client doesn't see the real servers behind it.
📖 Answer
A forward proxy example: employees inside a company reach the internet only through the corporate proxy. The proxy blocks forbidden sites and logs the traffic.
A reverse proxy example: Nginx sitting in front of your Spring Boot application.
server {
listen 443 ssl;
server_name shop.example.uz;
location /static/ {
root /var/www; # serves static files itself
}
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
A reverse proxy usually terminates TLS, serves static files, compresses (gzip), caches responses and splits load across several backends — so a load balancer is a kind of reverse proxy too.
One practical subtlety: behind a proxy, the application sees the proxy's IP instead of the client's IP. The real IP arrives in the X-Forwarded-For header, and in Spring Boot you need the server.forward-headers-strategy=framework setting.
Sign up to mark studied questions and save your progress.