Primary finding
Matcher excludes static asset extensions only at end of path, missing query strings and case variants
- apps/web/middleware.ts:49-53
The matcher anchors `.png$`, `.svg$`, `.ico$` to end-of-pathname. Next.js matchers run against the pathname (not including query), so query strings aren't a concern, but uppercase extensions (e.g., `/logo.PNG`) would still trigger middleware and have security headers applied. Applying security headers to images is harmless (in fact arguably desirable), so this is not a bug — but it's also not what the comment 'static asset files' implies. Other common static assets (`.jpg`, `.jpeg`, `.webp`, `.gif`, `.css`, `.js`, `.woff2`) are not excluded and will hit middleware on every request, adding latency at edge. Worth a sanity-check whether the exclusion list is intentional or partial.
Recommendation
Either broaden the exclusion list to cover all served static asset types, or confirm in a comment that running middleware on most static files is intentional (security headers on JS/CSS are valuable; on images they're neutral).