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
Three connected blocks labeled Observe, Decide, and Act.

Frame policy names who may embed your page

Clickjacking deceives a user about which interface receives an action. A hostile parent can place a framed application behind a misleading visual layer so that a click reaches a real control in that application. The parent need not read the child’s DOM for the user to interact with it. Same-origin read restrictions therefore do not replace a decision about whether the application may be embedded at all. ...

September 23, 2027 · 5 min · XB Field Notes
A server being tricked into fetching an internal address on behalf of an attacker.

SSRF makes the server open the door

Any feature that takes a user-supplied URL and fetches it server-side runs that fetch with the server’s identity, network position and credentials. A thumbnailer, a webhook tester, an importer, a PDF renderer — the moment the target comes from the request, the attacker is not visiting your internal network. Your server is visiting it for them. ...

September 5, 2027 · 5 min · XB Field Notes
A logged-in session being tricked by another page into a state change.

CSRF asks the browser where the request came from

Browsers attach cookies to any request, whatever page caused it. Anti-CSRF tokens and SameSite cookies bind each state change to an intent the user actually saw. Cookies travel without asking Browsers attach cookies to a request based on the target’s domain and path, not on whether the page causing the request was the user’s earlier intent. That means a page on an attacker’s origin can make the victim’s browser send a state-changing request — a transfer, a password change — that carries the authenticated session cookie, and the server sees a request that looks like it came from the legitimate user. This is why a request’s mere presence of credentials is not evidence of the user’s intent; the browser is following the cookie rules, not the user’s choice. ...

September 4, 2027 · 5 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