Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chtjonas/httkey-server
HTTP server that serves files based on the hash of the URL
https://github.com/chtjonas/httkey-server
blake file-server go golang http-server murmurhash3 static-file-server
Last synced: 29 days ago
JSON representation
HTTP server that serves files based on the hash of the URL
- Host: GitHub
- URL: https://github.com/chtjonas/httkey-server
- Owner: CHTJonas
- License: bsd-2-clause
- Created: 2021-01-07T23:28:26.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-05T19:43:54.000Z (about 2 months ago)
- Last Synced: 2024-11-05T20:38:31.390Z (about 2 months ago)
- Topics: blake, file-server, go, golang, http-server, murmurhash3, static-file-server
- Language: Go
- Homepage:
- Size: 346 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# httkey
httkey is a simple web server that serves static files but with a twist. The host and path of an incoming HTTP request are hashed and the result of this is used to determine the file to serve. httkey was in part inspired by Google's SFFE (Static File Front End) web server.
## Design Specification
* Binaries should be statically-linked with any assets (e.g. error pages) embedded.
* Files should be served from a single directory. There should be no sub-hierarchy.
* The hash should be a 128-bit MurmurHash3 of the request path, seeded with the contents of the `Host` header.
* The binary output of the hash should be encoded in hexadecimal form.
* If a file exists with a name that matches the hex-encoded output of the hash and the request method is `GET` then we should serve it.
* If a file exists but the requests method is not `GET` then we should serve a `405` error page.
* If a file does not exist then we should serve a `404` error page.It's expected that httkey will be run behind a reverse proxy such as nginx which will take care of the TLS termination. As such, URLs are often handled internally as `http` rather than `https` however this makes no practical difference. Port numbers also have no bearing on the overall hashing.
## Build
To compile httkey you can run the following in a terminal. This will produce 64-bit binaries for Windows and macOS in addition to Linux binaries for the `arm`, `arm64`, `i386` and `amd64` architectures.
```bash
make clean && make build
```## Quickstart
This quick example demonstrates how you can deploy a static [MTA-STS policy](https://en.wikipedia.org/wiki/MTA-STS) ([RFC 8461](https://tools.ietf.org/html/rfc8461)) using httkey:
```
$ httkey hash http://mta-sts.example.com/.well-known/mta-sts.txt
http://mta-sts.example.com/.well-known/mta-sts.txt c18eefdae3a2b5d69501ac89b6c5a9e69087e601$ cat > /tmp/c18eefdae3a2b5d69501ac89b6c5a9e69087e601 <