http-party / http-server

a simple zero-configuration command-line http server
MIT License
13.42k stars 1.48k forks source link

gz not served #877

Open Chr96er opened 3 months ago

Chr96er commented 3 months ago

I'm trying to serve compressed versions of my HTML files. I've added the -g flag and I see Serve GZIP Files: true during startup. I've zipped a test file using gzip.

As you can see in the screenshot the request header contains Accept-Encoding: gzip.

I'm basically seeing this issue but I'm on version 14.1.1

image

Environment Versions

  1. Node version: 20.8.0 (node:20.8.0-slim docker image)
  2. http-server version: 14.1.1

Steps to reproduce

Run http-server with -g flag and try to access a file (without .gz extension) for which a .gz version is available.

Expected result

The gzipped file is being served and decompressed client side.

Actual result

404 when trying to access the file without .gz extension.

Chr96er commented 3 months ago

Update: I manually ran fs.stat and hasGzipId12 in an interactive node session on the server (from within docker) and neither fails. !gzipErr is true and isGzip is also true. So I can only assume that something goes wrong before it even gets to that code.

cosmoburn commented 1 month ago

same but for br files