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 slash at the end of proxy_pass matters when it makes the directive include a URI. With a URI, Nginx replaces the part of the normalized request URI that matches the location prefix. Without a URI, it follows a different pass-through rule. A slash at the end of a location prefix is a separate case: it can trigger a redirect when a request omits that slash.

What a URI in proxy_pass changes

Nginx’s proxy module documentation says that when proxy_pass specifies a URI, Nginx replaces the portion of the normalized request URI matching the location with the URI in the directive.

location /name/ {
    proxy_pass http://127.0.0.1/remote/;
}

For an incoming path of /name/item, the matching /name/ prefix is replaced with /remote/, so the upstream path is /remote/item. The two trailing slashes shown here are parts of the location prefix and proxy URI respectively; the replacement rule explains how they combine.

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

This rule concerns the normalized request URI, not raw character-by-character editing of the request target.

What changes when proxy_pass has no URI

When the directive ends at the upstream address, there is no URI to replace the matched location prefix. Nginx documents a different behavior: for an original request, it passes the request URI in its original form; if processing has changed the URI, it passes the full normalized URI.

location /some/path/ {
    proxy_pass http://127.0.0.1;
}

Here, the absence of a slash or other URI after 127.0.0.1 is significant. Do not read this form as if it supplied / and replaced /some/path/.

Do not confuse the location slash with the proxy URI

Nginx’s core module documentation describes a separate rule for slash-terminated prefix locations. When such a location is handled by proxy_pass (or certain other pass directives), a request whose URI exactly matches the location string but lacks its final slash receives a permanent 301 redirect with the slash appended.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

For example, a request for /name can be redirected to /name/ when the relevant location is location /name/. This is request handling at the location boundary; it is not the prefix-replacement rule for a URI-bearing proxy_pass.

Work out the upstream path

  1. Write down the incoming request path and identify which location matches it.

  2. Check whether proxy_pass contains a URI after the upstream address. A URI-bearing form invokes the replacement rule; a form with only the upstream address follows the no-URI behavior.

  3. If there is a URI, replace the portion of the normalized request URI that matches the location with the URI from proxy_pass. Keep the unmatched remainder of the path.

    Free tools Windows power users keep installed

    One-click scans. No signup required.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  4. Check separately whether the request exactly matches a slash-terminated prefix location while omitting its final slash. That can produce the documented 301 redirect before the upstream-path question arises.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Cases that need separate handling

Regex and named locations

For regex and named locations, Nginx says it cannot determine the portion of the URI to replace. Use proxy_pass without a URI in these locations, as described in the proxy module documentation.

A rewrite followed by break

If a rewrite changes the URI in a proxied location and processing continues in that configuration using break, Nginx ignores the URI in proxy_pass and passes the full changed request URI upstream.

Variables in proxy_pass

Variable-based proxy_pass has different URI handling: if a URI is specified, it is passed as-is and replaces the original request URI. Do not assume the ordinary location-prefix example applies unchanged; check the exact directive and how its variables are constructed.

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

Check the documentation for your Nginx version

The official Nginx documentation pages linked here were checked on October 7, 2026. Because behavior can be version-specific, consult the documentation corresponding to the Nginx release you run when validating a configuration.

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.