Regex declaration order changes the selected handler while exact and longest-prefix rules retain their own priority.

nginx chooses the first matching regex, not a specificity score

nginx does not assign a general specificity score to every location expression. Ordinary prefixes are selected by matching length, exact locations can finish the search, and competing regex locations are evaluated in declaration order. A regex that looks narrower to a human can lose to a broader expression placed earlier. Mixing these selection rules is a common reason apparently careful routing changes affect unexpected paths. ...

December 27, 2027 · 5 min · XB Field Notes
nginx can forward an unfinished response while buffering; finite storage determines how far it can run ahead.

Response buffering absorbs a speed difference within a resource budget

Response buffering lets nginx read from an upstream while delivering data to a client at another pace. With proxy_buffering on, nginx uses configured memory buffers and can write part of a large response to a temporary file. It need not collect the entire response before sending the first bytes. The available buffering determines how far the two connections can progress independently. ...

December 7, 2027 · 6 min · XB Field Notes
Accept-Encoding permits gzip, Content-Encoding identifies it, and decompression verifies the delivered content.

Enable gzip explicitly, then verify negotiation and decoded bytes

gzip is a response content coding: nginx can send a compressed representation that an accepting client decodes. Enabling it requires gzip on; gzip_types extends the eligible MIME types but does not activate compression by itself. The result depends on the response, request capabilities, and effective configuration. A smaller body is useful only if it still decodes to the intended content. ...

August 29, 2027 · 5 min · XB Field Notes
The same key shares a budget, a changed key selects another, and an empty key is not counted.

A request limit protects the budget named by its key

A request-rate limit applies to the identity expressed by its key, not automatically to a person, account, or endpoint. limit_req_zone stores shared state for those key values, and limit_req applies the zone while handling a request. Two locations using the same zone and key can consume the same budget. Choosing a variable therefore defines a real fairness and enforcement boundary. ...

August 28, 2027 · 6 min · XB Field Notes
The application receives trustworthy connection context only when the proxy establishes how client-supplied headers are handled.

A reverse proxy needs an explicit header trust boundary

A reverse proxy accepts a client connection and makes a separate request to an upstream application. The application’s socket peer is therefore the proxy, while information about an earlier client can arrive through request headers. Those headers are useful only when the deployment defines who may set them and how they are validated. Proxying a request does not automatically make every forwarded identity or scheme claim trustworthy. ...

August 27, 2027 · 5 min · XB Field Notes
The original request URI stays available while normalization and internal redirects change the path used for routing.

nginx matches normalized paths and can select a location again

nginx location matching uses a normalized URI path rather than the untouched request-target text. Percent-encoded characters are decoded, relative path components are resolved, and adjacent slashes can be merged according to configuration. Later processing can change the current URI again and trigger another location search. Understanding both transformations is necessary when a request appears to enter a different handler than its original spelling suggests. ...

August 26, 2027 · 5 min · XB Field Notes
JSON escaping protects string content, while quoted optional fields preserve valid records when a value is absent.

Structured nginx logs need escaping and a value-type contract

A log_format that resembles JSON is not necessarily a reliable structured event format. nginx substitutes variable values into the text, and those values can contain quotes, backslashes, control characters, or no data at all. Correct string escaping and correct value types are separate requirements. Testing emitted records with a real parser catches failures that a visually convincing configuration or successful nginx -t cannot establish. ...

July 15, 2027 · 6 min · XB Field Notes
A short-lived copy of the backend answer served from disk.

nginx proxy cache balances stale and fresh

An nginx proxy cache has several independent decisions: identifying the stored response, deciding whether it may be reused, deciding whether a new response may be stored, and handling an expired copy. Treating those decisions as one TTL setting makes failures difficult to explain. Verify the resulting request path and bytes, not merely that nginx accepts the configuration. ...

June 24, 2027 · 6 min · XB Field Notes