(headers: Record<string, string>)
| 28 | } |
| 29 | |
| 30 | function proxyResponseHeaders(headers: Record<string, string>) { |
| 31 | const result = new Headers(headers) |
| 32 | // FetchHttpClient exposes decoded response bodies, so forwarding upstream |
| 33 | // transfer metadata makes browsers decode already-decoded assets again. |
| 34 | result.delete("content-encoding") |
| 35 | result.delete("content-length") |
| 36 | result.delete("transfer-encoding") |
| 37 | return result |
| 38 | } |
| 39 | |
| 40 | export function upstreamURL(path: string) { |
| 41 | return new URL(path, UI_UPSTREAM).toString() |