next.js
cb0b62fd - Leave a plain request path alone in normalizeCdnUrl

Commit
25 days ago
Leave a plain request path alone in normalizeCdnUrl normalizeCdnUrl parses req.url, removes routing params from the query and formats the URL again, for every request: 3.6us on a route handler. For a URL that is an absolute path of unreserved characters (letters, digits, '-', '.', '_', '~' and '/'), without a query or a hash, without a leading '//' and without '.' or '..' segments, the result is the URL it started with: there is no query to strip, the URL parser neither encodes nor decodes those characters and has no authority or dot segment to resolve, and formatUrl returns the pathname. Return early for such a URL.
Author
Committer
Parents
Loading