Intern
What is a proxy?
sobes.tech AI
Answer from AI
A proxy server (or simply proxy) is a server that acts as an intermediary between a client and another server.
It accepts requests from clients and forwards them to target servers, then returns responses from the target servers to the clients.
Main functions and types of proxies:
- Caching: Stores copies of frequently requested resources, speeding up access and reducing load on target servers.
# Example of caching in Nginx proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m max_size=10g inactive=60m use_temp_path=off; server { listen 80; location / { proxy_pass http://backend_server; proxy_cache my_cache; proxy_cache_valid 200 10m; # Cache 200 responses for 10 minutes } } - Traffic filtering: Blocks access to unwanted resources or content.
- Load balancing: Distributes incoming requests among multiple target servers to improve availability and performance.
# Example of load balancing in Nginx upstream backend_servers { server backend1.example.com; server backend2.example.com; server backend3.example.com; } server { listen 80; location / { proxy_pass http://backend_servers; } } - Security enhancement: Protects internal networks, hides IP addresses of clients or servers, inspects traffic.
- Geotargeting and bypassing restrictions: Provides access to resources unavailable from the client's region.
Main types of proxies:
| Proxy Type | Description | Use cases |
|---|---|---|
| Forward Proxy | Clients use proxies to access external resources. Protects clients. | Corporate networks for internet access control. |
| Reverse Proxy | Located in front of servers and handles requests from external clients. Protects servers. | Web servers for load distribution, SSL termination, caching. |
| Transparent Proxy | Clients are unaware of its existence, traffic is redirected at the network level. | Network devices (routers) for traffic filtering. |
| SOCKS Proxy | Supports various protocols (HTTP, HTTPS, FTP, etc.). Operates at a lower level than HTTP proxies. | Bypassing firewalls, increasing anonymity. |
Proxies are a critical component in modern network infrastructures for ensuring performance, security, and accessibility.