fix(opencode): strip transfer-encoding in UI proxy and allow public manifest assets (#25698)
Co-authored-by: Kit Langton <kit.langton@gmail.com>
This commit is contained in:
12
packages/opencode/src/server/shared/public-ui.ts
Normal file
12
packages/opencode/src/server/shared/public-ui.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// Static UI assets the browser fetches without app-managed credentials, e.g.
|
||||
// the manifest link in <head>. These bypass auth so the page can install/render
|
||||
// the manifest icons even when a server password is configured.
|
||||
export const PUBLIC_UI_PATHS = new Set<string>([
|
||||
"/site.webmanifest",
|
||||
"/web-app-manifest-192x192.png",
|
||||
"/web-app-manifest-512x512.png",
|
||||
])
|
||||
|
||||
export function isPublicUIPath(method: string, pathname: string) {
|
||||
return method === "GET" && PUBLIC_UI_PATHS.has(pathname)
|
||||
}
|
||||
@@ -33,6 +33,7 @@ function proxyResponseHeaders(headers: Record<string, string>) {
|
||||
// transfer metadata makes browsers decode already-decoded assets again.
|
||||
result.delete("content-encoding")
|
||||
result.delete("content-length")
|
||||
result.delete("transfer-encoding")
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user