Fix for netlify stupid encoding issue
Some checks failed
Linting and Testing / Run Linters (push) Has been cancelled
Linting and Testing / Build project (push) Has been cancelled
Linting and Testing / Build docker (push) Has been cancelled
Docker Publish / build (push) Has been cancelled
Release / Release (push) Has been cancelled

This commit is contained in:
TPN 2025-01-31 13:42:31 +00:00
parent d698358f64
commit 46560bac90
2 changed files with 2795 additions and 2198 deletions

File diff suppressed because it is too large Load diff

View file

@ -57,6 +57,16 @@ export async function specificProxyRequest(
const method = opts.fetchOptions?.method || event.method;
const oldHeaders = getProxyRequestHeaders(event);
// netlify seems to be changing the content-encoding header to gzip when the reponse is encoded in zstd
// so as temp fix just not sending zstd in accept encoding
if (oldHeaders['accept-encoding']?.includes('zstd'))
oldHeaders['accept-encoding'] = oldHeaders['accept-encoding']
.split(',')
.map((x: string) => x.trim())
.filter((x: string) => x !== 'zstd')
.join(', ');
opts.blacklistedHeaders?.forEach((header) => {
const keys = Object.keys(oldHeaders).filter(
(v) => v.toLowerCase() === header.toLowerCase(),