From c430ae8dd67fce3faeb9c91ee7420bbce2870249 Mon Sep 17 00:00:00 2001 From: Matchu Date: Mon, 21 Sep 2020 11:42:24 -0700 Subject: [PATCH] oh, oops, _do_ send Content-Type with proxied JS right, _length_ only works if we're streaming unencoded content, but type is still good no matter what! --- api/assetProxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/assetProxy.js b/api/assetProxy.js index 96aa788..55f04b3 100644 --- a/api/assetProxy.js +++ b/api/assetProxy.js @@ -36,6 +36,7 @@ export default async (req, res) => { res.status(proxyRes.status); + res.setHeader("Content-Type", proxyRes.headers.get("Content-Type")); res.setHeader("Cache-Control", proxyRes.headers.get("Cache-Control")); res.setHeader("ETag", proxyRes.headers.get("ETag")); res.setHeader("Last-Modified", proxyRes.headers.get("Last-Modified")); @@ -44,7 +45,6 @@ export default async (req, res) => { // If the content is not encoded (I think their images generally aren't?), // stream the body directly, to speed things up a bit. res.setHeader("Content-Length", proxyRes.headers.get("Content-Length")); - res.setHeader("Content-Type", proxyRes.headers.get("Content-Type")); await streamPipeline(proxyRes.body, res); } else { // Otherwise, I don't immediately know how to stream encoded content, so,