https://github.com/mt-inside/http-log
Dumps http requests that come its way
https://github.com/mt-inside/http-log
Last synced: 5 months ago
JSON representation
Dumps http requests that come its way
- Host: GitHub
- URL: https://github.com/mt-inside/http-log
- Owner: mt-inside
- Created: 2021-01-13T00:42:28.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-04-15T14:00:51.000Z (about 1 year ago)
- Last Synced: 2025-10-28T01:37:42.710Z (8 months ago)
- Language: Go
- Size: 457 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# http-log
[](https://github.com/mt-inside/http-log/actions/workflows/test.yaml)
[](https://pkg.go.dev/github.com/mt-inside/http-log)
[](https://goreportcard.com/report/github.com/mt-inside/http-log)
TODO Asciinema etc
## Stand-alone Daemon
These args will listen on `https://0.0.0.0:8080` with a self-signed cert, log requests, and respond with a json object. See `http-log -h`.
Run from container image:
```bash
docker run -t --rm -p8080:8080 ghcr.io/mt-inside/http-log:v0.7.15
```
Download single, statically-linked binary
```bash
wget -O http-log https://github.com/mt-inside/http-log/releases/download/v0.7.15/http-log-$(uname -s)-$(uname -m)
chmod u+x http-log
./http-log
```
Install from source
```bash
go install github.com/mt-inside/http-log/cmd/http-log@latest
${GOPATH}/bin/http-log
```
## AWS Lambda
`docker build ./cmd/lambda`
Packaging and publishing is left as an exercise for the reader (I forgot how I did it)
# Usage
## HTTP Versions
Note: h2c - h2 cleartext - is the name for h2/plaintext. The "correct" way to initiate such a connection is to send an http/1.1 request with an `Upgrade: h2c` field. Of course a client (like an Envoy proxy) can be configured with a-priori knowledge that the server accepts h2c, and just send h2 right away.
* With TLS (a `-K` option other than `off`, or `-k/-c`)
* Default: TLS's ALPN field allows client and server to negotiate HTTP version. http-log supports h2, and any modern client will do as well. The default with TLS enabled is "let it negotiate", which makes h2 effectively the default.
* With `--http-11`: we force http/1.1. This is done by returning _no_ protocols in the ALPN field, which means negotiation can't happen, and the default is used, which is http/1.1.
* Without TLS (`-K=off`, or no `-K` and no `-k/-c`) http/1.1 is the "standard" version. It's usually quite hard to force clients (and server libraries) to do h2 over plaintext.
* Default: because of some magic in the Go libraries, it's able to accept either http/1.1 or h2 simultaneously. h2 connections can either be h2 on the first request, or can upgrade with an HTTP/1.1 call with header `Upgrade: h2c`.
* With `--http-11`: we disable the h2 handling. http/1.1 will work fine.
* If you send an h2c upgrade request you'll see it printed, but the h2 upgrade and "main" request won't happen.
* If you send an immediate h2 request, you'll see a log of a PRI method, with no other data (as that very first part of the h2 request is h1 compatible)