mars/create-react-app-buildpack

Configure to serve .gz file with HTTP Response Header "Content-Encoding: gzip"

leolambo opened this issue · 1 comments

I am trying to parse a .gz file to be able to run WebGL code present in my react app. I am getting the following error

Unable to parse /build/file.framework.js.gz! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: gzip" present. Check browser Console and Devtools Network tab to debug.

"Content-Encoding" is missing altogether and "Content-Type" is not gzip. My response header looks like this:

HTTP/1.1 200 OK Connection: keep-alive Server: nginx Date: XXXXXXXX Content-Type: application/octet-stream Content-Length: 91235 Last-Modified: XXXXXXXX Etag: "XXXXXXX-XXXXX" Accept-Ranges: bytes Via: 1.1 vegur

is there any way I can configure the static.json to ensure the correct encoding is present and this error resolves?

mars commented

Yes, response headers are configurable. The README section for customizing the web server links to the static web server docs:

Custom Headers

Using the headers key, you can set custom response headers.