From 08632a3a07cfe3381b61b92c2641adf83170c203 Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Sat, 18 Jun 2022 02:09:44 -0700 Subject: [PATCH] Correctly proxy GET and HEAD requests instead of dying (#542) --- web/lib/api/proxy.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/lib/api/proxy.ts b/web/lib/api/proxy.ts index 0e70f546..6b83ff2b 100644 --- a/web/lib/api/proxy.ts +++ b/web/lib/api/proxy.ts @@ -41,7 +41,9 @@ export const fetchBackend = (req: NextApiRequest, name: V2CloudFunction) => { 'Content-Type', 'Origin', ]) - return fetch(url, { headers, method: req.method, body: req }) + const hasBody = req.method != 'HEAD' && req.method != 'GET' + const opts = { headers, method: req.method, body: hasBody ? req : undefined } + return fetch(url, opts) } export const forwardResponse = async (