Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A reverse proxy accepts a client’s request at a public-facing endpoint, selects an upstream server, forwards the request, and relays the response. In nginx, the proxy_pass directive helps determine where the request goes—and, depending on its configuration, what URI the backend receives.

The simplest way to understand why a reverse proxy works is to follow the two connections it handles: client to proxy, then proxy to backend. TLS termination, header changes, caching, buffering, and load balancing can be added, but they are separate configuration choices rather than requirements of forwarding.

What happens when a request reaches a reverse proxy?

From the client’s perspective, the reverse proxy is the server it contacts. The proxy receives the request, evaluates its configuration, makes a request to an upstream server, and passes the upstream response back to the client. nginx describes its proxy module as one that “allows passing requests to another server.”

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. The client connects to the proxy. The browser or other client addresses the proxy’s public hostname or IP address.
  2. The proxy matches the request. nginx evaluates its server and location configuration to decide how to handle the request.
  3. The proxy makes an upstream request. A directive such as proxy_pass identifies the upstream protocol and destination; the configuration can also affect the URI and request headers sent to that server.
  4. The proxy relays the result. The backend’s response returns through the proxy to the client.

This explains how an application can sit behind a public endpoint: the client talks to the proxy, not directly to the backend. Whether the backend is actually concealed or unreachable from other networks depends on the network and access-control setup; proxying alone does not guarantee that.

#1 Best Overall
TP-Link AC1200 Gigabit Dual Band WiFi Router (Archer A6)
  • Dual band router upgrades to 1200 Mbps high speed internet (300mbps for 2.4GHz plus 900Mbps for 5GHz), reducing buffering and ideal for 4K stream
  • Full Gigabit Ports - Gigabit Router with 4 Gigabit LAN ports, ideal for any internet plan and allow you to directly connect your wired devices
  • Boosted Coverage - Four external antennas equipped with Beamforming technology extend and concentrate the Wi-Fi signals
  • MU-MIMO technology - (5GHz band) allows high speeds for multiple devices simultaneously
  • Access Point Mode - Supports AP Mode to transform your wired connection into wireless network, an ideal wireless router for home

How does nginx choose the upstream and path?

In nginx, proxy_pass specifies an http or https upstream URL. Its destination can be a domain name, IP address, port, or configured server group. The URI portion matters: when one is present, nginx’s documented rules replace the portion of the request URI matching the location with the URI in proxy_pass. Without a URI, nginx follows different request-URI handling rules.

For example, if a request matches a location for /api/, a proxy_pass destination that includes a URI can cause the backend to receive a rewritten path rather than the original path. Exact results depend on the location and slash configuration, so check the nginx documentation for the release and configuration you are using before relying on a particular mapping.

Rank #2
Sale
TP-Link ER605, Wired Gigabit VPN Router
  • 【Five Gigabit Ports】1 Gigabit WAN Port plus 2 Gigabit WAN/LAN Ports plus 2 Gigabit LAN Port. Up to 3 WAN ports optimize bandwidth usage through one device.
  • 【One USB WAN Port】Mobile broadband via 4G/3G modem is supported for WAN backup by connecting to the USB port. For complete list of compatible 4G/3G modems, please visit TP-Link website.
  • 【Abundant Security Features】Advanced firewall policies, DoS defense, IP/MAC/URL filtering, speed test and more security functions protect your network and data.
  • 【Highly Secure VPN】Supports up to 20× LAN-to-LAN IPsec, 16× OpenVPN, 16× L2TP, and 16× PPTP VPN connections.
  • Security - SPI Firewall, VPN Pass through, FTP/H.323/PPTP/SIP/IPsec ALG, DoS Defence, Ping of Death and Local Management. Standards and Protocols IEEE 802.3, 802.3u, 802.3ab, IEEE 802.3x, IEEE 802.1q

The key distinction is that nginx is not merely forwarding an untouched packet. It handles a client request and constructs an upstream request according to its configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why can the backend see different request headers?

The proxy can redefine or add request fields before passing the request upstream. nginx provides proxy_set_header for this purpose. That can matter when an application uses the Host field for virtual hosting, tenant selection, redirects, or URL generation.

Rank #3
Sale
TP-Link AC1200 WiFi Router Dual Band Wireless Internet Router (Archer A54)
  • Dual-band Wi-Fi with 5 GHz speeds up to 867 Mbps and 2.4 GHz speeds up to 300 Mbps, delivering 1200 Mbps of total bandwidth¹. Dual-band routers do not support 6 GHz. Performance varies by conditions, distance to devices, and obstacles such as walls.
  • Covers up to 1,000 sq. ft. with four external antennas for stable wireless connections and optimal coverage.
  • Supports IGMP Proxy/Snooping, Bridge and Tag VLAN to optimize IPTV streaming
  • Access Point Mode - Supports AP Mode to transform your wired connection into wireless network, an ideal wireless router for home
  • Advanced Security with WPA3 - The latest Wi-Fi security protocol, WPA3, brings new capabilities to improve cybersecurity in personal networks

nginx’s default Host handling uses $proxy_host. A configuration can instead use $host or $http_host; these variables are not interchangeable in every case, particularly if the client did not send a Host field. Choose a value based on the application’s routing needs, and confirm what the backend actually receives.

Client-address information is also commonly conveyed in headers. nginx’s $proxy_add_x_forwarded_for value appends the proxy’s remote address to an existing X-Forwarded-For field, or initializes the field with that address when none exists. Such headers are not inherently trustworthy: an application should rely on forwarded values only from a known, correctly configured proxy chain.

Rank #4
Sale
TP-Link AX1800 WiFi 6 Router (Archer AX21 V5)
  • DUAL-BAND WIFI 6 ROUTER: Wi-Fi 6(802.11ax) technology achieves faster speeds, greater capacity and reduced network congestion compared to the previous gen. All WiFi routers require a separate modem. Dual-Band WiFi routers do not support the 6 GHz band.
  • AX1800: Enjoy smoother and more stable streaming, gaming, downloading with 1.8 Gbps total bandwidth (up to 1200 Mbps on 5 GHz and up to 574 Mbps on 2.4 GHz). Performance varies by conditions, distance to devices, and obstacles such as walls.
  • CONNECT MORE DEVICES: Wi-Fi 6 technology communicates more data to more devices simultaneously using revolutionary OFDMA technology
  • EXTENSIVE COVERAGE: Achieve the strong, reliable WiFi coverage with Archer AX1800 as it focuses signal strength to your devices far away using Beamforming technology, 4 high-gain antennas and an advanced front-end module (FEM) chipset
  • OUR CYBERSECURITY COMMITMENT: TP-Link is a signatory of the U.S. Cybersecurity and Infrastructure Security Agency’s (CISA) Secure-by-Design pledge. This device is designed, built, and maintained, with advanced security as a core requirement.

Does HTTPS to the proxy also encrypt the backend connection?

No. The client-to-proxy connection and proxy-to-backend connection are separate hops, and each needs its own decision about encryption.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Client to nginx: an HTTPS listener uses nginx’s ssl parameter and certificate and private-key paths in the server configuration. Restrict access to the private-key file.
  • nginx to the upstream: the scheme in proxy_pass can be http or https. An HTTPS public listener does not, by itself, make the upstream hop encrypted.

The nginx HTTPS documentation page accessed for this article lists TLSv1.2 and TLSv1.3 as its default protocol set. Defaults can vary by nginx release, so verify the documentation and configuration for the version you run rather than assuming a default is universal.

Best Value
TP-Link Dual-Band AX3000 Wi-Fi 6 Wireless Gigabit Internet Router for Home
  • Next-Gen Gigabit Wi-Fi 6 Speeds: 2402 Mbps on 5 GHz and 574 Mbps on 2.4 GHz bands ensure smoother streaming and faster downloads; support VPN server and VPN client¹
  • A More Responsive Experience: Enjoy smooth gaming, video streaming, and live feeds simultaneously. OFDMA makes your Wi-Fi stronger by allowing multiple clients to share one band at the same time, cutting latency and jitter.²
  • Expanded Wi-Fi Coverage: 4 high-gain external antennas and Beamforming technology combine to extend strong, reliable, Wi-Fi throughout your home.
  • Improved Battery Life: Target Wake Time helps your devices to communicate efficiently while consuming less power.
  • Improved Cooling Design: No heat ups, no throttles. A larger heat sink and redefined case design cools the WiFi 6 system and enables your network to stay at top speeds in more versatile environments.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How does load balancing fit into proxying?

Proxying establishes the forwarding path; load balancing adds a policy for choosing among upstream servers. nginx documents several methods, each suited to different traffic patterns rather than universally best for all deployments.

Method How it selects a server What to consider
Round-robin Distributes requests in turn. It does not ensure successive requests from one client reach the same server.
Least-connected Favors a server with fewer active connections. nginx notes this can help when requests take different amounts of time.
IP hash Uses the client IP as a hash key to tend to direct a client to the same server, except when that server is unavailable. This provides a form of affinity, not a general guarantee that application sessions will work correctly.

When choosing a method, consider how much request durations vary, whether application state is shared across backends, what client address the proxy can see, and how backend capacity and failures should affect routing.

nginx also documents passive handling of upstream communication failures. An upstream can be treated as failed and avoided temporarily; settings such as max_fails and fail_timeout affect that behavior. This is failure handling, not a substitute for designing the application and deployment to tolerate unavailable servers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the mental model helps you troubleshoot

When a request behaves unexpectedly, trace it across the two connections instead of treating the proxy as a black box:

  • Confirm that the client reaches the intended public listener and that the request matches the expected server and location.
  • Check the configured proxy_pass scheme, destination, and URI against the request the backend is meant to receive.
  • Inspect the Host and forwarded-address fields arriving at the backend, and verify that the application trusts only the intended proxy chain.
  • Check whether TLS is enabled on the client-facing listener and separately whether the upstream URL uses HTTPS.
  • If nginx selects among multiple backends, verify the balancing method and failure settings against the desired affinity and availability behavior.

These checks connect a configuration directive to an observable result: which backend received the request, what that backend saw, and how the response returned to the client.

Quick Recap

Bestseller No. 1
TP-Link AC1200 Gigabit Dual Band WiFi Router (Archer A6)
TP-Link AC1200 Gigabit Dual Band WiFi Router (Archer A6)
MU-MIMO technology - (5GHz band) allows high speeds for multiple devices simultaneously
$44.99
SaleBestseller No. 2
SaleBestseller No. 3
TP-Link AC1200 WiFi Router Dual Band Wireless Internet Router (Archer A54)
TP-Link AC1200 WiFi Router Dual Band Wireless Internet Router (Archer A54)
Supports IGMP Proxy/Snooping, Bridge and Tag VLAN to optimize IPTV streaming
$29.99
SaleBestseller No. 4
TP-Link AX1800 WiFi 6 Router (Archer AX21 V5)
TP-Link AX1800 WiFi 6 Router (Archer AX21 V5)
VPN SERVER: Archer AX21 Supports both Open VPN Server and PPTP VPN Server
$69.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.