I can't tell you how to implement one from scratch if that's your question, but I use apache httpd with mod_fcgi.
This server isn't directly exposed, only valid requests are proxied to it.
I have no reason to think this is the best approach, it's a near forgotten foundational layer of an application that has been stable and reliable for a decade, that is under constant attack and regularly pen-tested.
Comments
Go supports FastCGI out of the box (and regular CGI) and might not be a bad place to look, unless I'm misunderstanding what you're asking:
https://golang.org/pkg/net/http/fcgi/
Underlying code:
https://golang.org/src/net/http/fcgi/
Edit:
They also link to a 'unofficial' spec they referenced it seems https://fast-cgi.github.io/
And to pair with this, Caddy has a fastcgi transport for the proxy module https://caddyserver.com/docs/caddyfile/directives/reverse_pr...
Or if you're running PHP, this shortcut usually does the right thing: https://caddyserver.com/docs/caddyfile/directives/php_fastcg...
I can't tell you how to implement one from scratch if that's your question, but I use apache httpd with mod_fcgi.
This server isn't directly exposed, only valid requests are proxied to it.
I have no reason to think this is the best approach, it's a near forgotten foundational layer of an application that has been stable and reliable for a decade, that is under constant attack and regularly pen-tested.