https://github.com/luzifer/gziphttp
Very simple HTTP server for serving static files with ability for gzip compression if supported by the client
https://github.com/luzifer/gziphttp
golang gzip http server
Last synced: about 1 month ago
JSON representation
Very simple HTTP server for serving static files with ability for gzip compression if supported by the client
- Host: GitHub
- URL: https://github.com/luzifer/gziphttp
- Owner: Luzifer
- License: apache-2.0
- Created: 2019-06-01T23:12:58.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-03T13:26:53.000Z (almost 5 years ago)
- Last Synced: 2025-06-12T08:02:06.051Z (about 1 month ago)
- Topics: golang, gzip, http, server
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://goreportcard.com/report/github.com/Luzifer/gziphttp)


# Luzifer / gziphttp
Very simple HTTP server for serving static files with ability for gzip compression if supported by the client.
## Usage
```console
# gziphttp -h
Usage of gziphttp:
--listen string Port/IP to listen on (default ":3000")
--log-level string Log level (debug, info, warn, error, fatal) (default "info")
-d, --serve-dir string Directory to serve files from (default ".")
--version Prints current version and exits
```Here is an example usage inside a Docker container containing (quite large) compiled JavaScript files:
```dockerfile
FROM golang:alpine as goRUN set -ex \
&& apk add git \
&& go get -v github.com/Luzifer/gziphttpFROM node:alpine as node
COPY . /src
WORKDIR /srcRUN set -ex \
&& npm ci \
&& npm run buildFROM alpine:latest
COPY --from=go /go/bin/gziphttp /usr/local/bin/
COPY --from=node /src/dist /usr/local/share/webtotpEXPOSE 3000/tcp
CMD ["gziphttp", "-d", "/usr/local/share/webtotp"]
```In this case `gziphttp` serves compressed files to most (all modern) browsers which ensures the download size of the JavaScript files does not hurt as much as it would without gzip compression.