# nginx: The Map Variable That Fixes the URI in proxy\_pass

DevFeed: [nginx: The Map Variable That Fixes the URI in proxy\_pass](<https://devfeed.tech/articles/nginx-the-map-variable-that-fixes-the-uri-in-proxy-pass-34110.md>)

Original publisher: [Read original article](<https://philipptheserver.com/posts/nginx-map-uri-cache-policy/>)

Author: Philipp Lehmann (philipp.lehmann@gruppe.ai)

Published: 2026-09-14T07:00:00Z

Content type: tutorial

Language: en

Sources: [Philipp Lehmann](<https://devfeed.tech/sources/philipp-lehmann.md>)

Topics: [nginx](<https://devfeed.tech/topics/nginx.md>), [proxy](<https://devfeed.tech/topics/proxy.md>), [Caching](<https://devfeed.tech/topics/caching.md>), [configuration](<https://devfeed.tech/topics/configuration.md>)

Tags: [cache-control](<https://devfeed.tech/tags/cache-control.md>), [ci-cd](<https://devfeed.tech/tags/ci-cd.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [docker](<https://devfeed.tech/tags/docker.md>), [networking](<https://devfeed.tech/tags/networking.md>), [nginx](<https://devfeed.tech/tags/nginx.md>), [observability](<https://devfeed.tech/tags/observability.md>), [proxy](<https://devfeed.tech/tags/proxy.md>), [reverse-proxy](<https://devfeed.tech/tags/reverse-proxy.md>)

## AI overview

This article explains an nginx build failure caused by using a URI-bearing proxy_pass inside a regex location. A newer nginx version treated the previously accepted configuration as an error. The proposed fix uses a bare upstream in the regex location and a map on $uri to apply a path-specific Cache-Control policy.

## Source excerpt

nginx: [emerg] invalid URI prefix in proxy_pass: a regex location needs a bare upstream, and a map on $uri keeps a path-specific Cache-Control header.