DevOps · Flashcard

How does adding a URI part to proxy_pass (e.g. proxy_pass http://back/app/) affect the forwarded path?

  • AThe part of the request URI matching the location is replaced by the proxy_pass URI
  • BThe proxy_pass URI is appended to the full original request URI before it is sent
  • CThe proxy_pass URI is ignored and the original request URI is always sent as-is
  • DThe request is rejected because proxy_pass may not contain a URI component at all

Why this is the answer

With a URI in proxy_pass, nginx replaces the matched location prefix with that URI (location /api/ plus proxy_pass http://back/app/ turns /api/x into /app/x). Without a URI the original request URI is passed unchanged, but it is never simply appended, never ignored, and a URI in proxy_pass is fully allowed.

Official docs
Study in Gnoseed →