Skip to content

access logs: tags are keyed by the frontend rule's hostname but read by the request authority, so every wildcard/regex frontend logs without its tags #1379

Closed

Description

@FlorentinDUBOIS

Observed on main at c7ac070e.

The HTTP and HTTPS proxies key the access-log tag cache by the frontend rule's
hostname, but read it back by the request's authority. The store is a
BTreeMap<String, CachedTags> (https.rs:1142, http.rs:736) and the read is
self.tags.get(key) (https.rs:1150-1152, http.rs:745-747) — exact key, no
pattern resolution.

Write side, HTTPS (https.rs:2222):

listener.set_tags(front.hostname.to_owned(), front.tags.to_owned());

HTTP is the twin (http.rs:1176). front.hostname is whatever the operator
configured: *.example.com for a wildcard frontend, /foo.*/.example.com for a
regex one, an arbitrary string for a Pre/Post rule.

Read side (lib/src/protocol/mux/stream.rs:397-403):

let tags = context.authority.as_deref().and_then(|host| {
    let hostname = match host.split_once(':') {
        None => host,
        Some((hostname, _)) => hostname,
    };
    listener.get_tags(hostname)
});

context.authority is a concrete host from the wire — foo.example.com.

Consequence

For every frontend whose hostname is not an exact literal, the key written can
never be produced by the key read, so get_tags returns None and the configured
tags are silently absent from every access log line for that frontend. Exact
frontends are unaffected, which is why this does not show up in ordinary testing.

Three distinct ways to miss, all from the same asymmetry:

  • wildcard / regex — *.example.com stored, foo.example.com looked up;
  • port — the read strips :port, the write does not, so a frontend hostname
    carrying a port never matches;
  • case — the write stores the operator's spelling, the read uses the request's.

tcp.rs already solved this

The TCP proxy builds a structured key with the same function on both sides:
sni_tags_key(&address, &sni, &front.alpn) at tcp.rs:2789/:2793 for the write
and tcp.rs:405 for the read, with TcpFrontendTagsKey::Address(address) as the
non-SNI fallback. HTTP/HTTPS pass raw strings from two different sources.

Suggested direction

Resolve the tag lookup through the router rather than a parallel exact map: the
router already knows which frontend rule matched this request, and that rule is the
only correct tag owner. Failing that, key the map by the matched frontend's
identity rather than by a hostname string that two call sites spell differently.

A regression test should assert that a request to foo.example.com against a
*.example.com frontend carries that frontend's tags in the access log — it is
red today.

Activity

  1. added 2 commits that reference this issue on Sep 21, 2026
    f7d7783
    07ad303
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions