mirror of
https://gh-proxy.org/https://github.com/klinsmaya/multica.git
synced 2026-11-10 18:36:45 +08:00
* fix(web): keep the /favicon.ico redirect relative
Response.redirect() only accepts an absolute URL, so the handler resolved
/favicon.svg against request.url. On a self-hosted deployment that carries
the server's own listen address rather than the public origin --
Dockerfile.web sets HOSTNAME=0.0.0.0 / PORT=3000, and a plain `next start`
defaults to the same -- so every client got
Location: http://0.0.0.0:3000/favicon.svg
which is unreachable, and leaks the internal bind address. The redirects
emitted by proxy.ts are already relative and were never affected.
Emit the Location header directly instead. A relative Location is valid per
RFC 7231 7.1.2 and resolves against whatever origin the client used, so it
needs no trust in Host / X-Forwarded-Host.
Closes #7116
Co-Authored-By: Claude Opus 5 <[email protected]>
* fix(web): keep /favicon.ico off the prerender cache path
Review catch on #7117. Reading `request.url` used to mark the route dynamic
implicitly; dropping that argument left nothing dynamic for Next to detect,
so it treated the handler as cacheable and tried to store a zero-byte body.
The prerender LRU rejects that outright, once per request:
Failed to update prerender cache for /favicon.ico
Error: LRUCache: calculateSize returned 0, but size must be > 0.
Every browser fetches /favicon.ico unprompted, so that is an error line per
request in every deployment, against a cache write that can never succeed.
`export const dynamic = "force-dynamic"` restores the per-request semantics
the old `request.url` read gave us by accident, without reintroducing the
absolute URL that #7116 is about.
Verified on a production build (`next build` + `next start`), before and
after. Before: `cache-control: s-maxage=31536000`, `x-nextjs-cache: MISS`,
and one calculateSize error per request. After: neither header, zero errors,
and the redirect still resolves to /favicon.svg (200 image/svg+xml).
Co-Authored-By: Claude Opus 5 <[email protected]>
---------
Co-authored-by: Claude Opus 5 <[email protected]>