From df8b6cd53cb478b2049b820eae5fcf2cc13ed005 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Sat, 19 Aug 2023 18:40:11 +0900 Subject: [PATCH] Fix unfurler resource proxying --- unfurler/src/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/unfurler/src/index.ts b/unfurler/src/index.ts index 69882579f..967d60117 100644 --- a/unfurler/src/index.ts +++ b/unfurler/src/index.ts @@ -259,9 +259,14 @@ class Server { return; } else { if (this.secureHost) { - https.get(config.SERVER.HOST + rawPath, { headers: { 'user-agent': 'mempoolunfurl' }}, (got) => got.pipe(res)); - } else { - http.get(config.SERVER.HOST + rawPath, { headers: { 'user-agent': 'mempoolunfurl' }}, (got) => got.pipe(res)); + https.get(config.SERVER.HOST + ':4200' + rawPath, { headers: { 'user-agent': 'mempoolunfurl' }}, (got) => { + res.writeHead(got.statusCode, got.headers); + return got.pipe(res); + }); } else { + http.get(config.SERVER.HOST + ':4200' + rawPath, { headers: { 'user-agent': 'mempoolunfurl' }}, (got) => { + res.writeHead(got.statusCode, got.headers); + return got.pipe(res); + }); } return; }