Friday, April 22, 2022

Small go clone of httpd

If anyone is interested have a small go clone of the httpd web server
here: https://github.com/aaronriekenberg/go-httpd

Not nearly as complete as the real httpd but has enough features to
roughly handle a config similar to /etc/examples/httpd.conf

Sample config file:
https://github.com/aaronriekenberg/go-httpd/blob/main/configfiles/gohttpd.json

Some things that work:
* Supports HTTP 1.1 and HTTP 2.0 via builtin go http server
* Uses JSON for simple config file parsing
* Uses chroot and setgid/setuid to drop privileges at startup after
creating server sockets and reading tls files.
* Configurable list of locations for each server that are matched in
order for each request
* For now only matching locations by URL path prefix but could easily
use go regexp package
* Configurable Cache-Control headers for file server locations
* Fastcgi support using github.com/yookoala/gofast library
* Request logging with file rotation
* Small amount of code using builtin go http server and handlers

No comments:

Post a Comment