Access HTTP/2 frames

Hey guys,

I’ve started to use Caddy recently and I’m wondering what would be the easiest way to access HTTP/2 (received; in the requests from the client) frames such as PRIORITY, SETTINGS, WINDOW_UPDATE, etc.

The 2 options I see are:

  1. Change the code of some libraries - but I couldn’t quite figure out where the part that after the TLS “stripping” and before the HTTP is.

  2. Write a plugin, and it would have to be of type: “Listener Middleware” is that correct? Using this plugin type would I be able to access the received frames themselves; after the TLS decryption (and not just the DATA or HEADER frames)?

Or perhaps there’s a debug mode in Caddy in which I’d be able to see an output similar to that of nghttp2 and h2c (verbose HTTP/2 curl-like-CLIs)?

Hmm please let me know if my question wasn’t clear or just share your opinion even if you’re not sure about it

I would start by setting the GODEBUG environment variable, as described here: http package - net/http - - this will at least be able to dump HTTP2 frame information. Then you can look in the source code for areas where there might be hooks available. But generally, that’s too low-level for an HTTP server. You’d probably need a TCP server or yes, a listener middleware, to get in between the HTTP application and the wire…

Thanks a lot!
“GODEBUG=http2debug=1” or =2 don’t seem to affect, while “GODEBUG=http2server=0” does.
Should the debug output be printed to the screen or is it saved in a file? Because I don’t get any output and couldn’t find more info about it…

Hey Matt, when I set up a go http2 server myself using “net/http” and “” like this for example: simple-go-http2-server/main.go at master · akhld/simple-go-http2-server · GitHub, the http2debug flag does work

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.