Yes, this makes sense. Although you will probably have to implement at least some of the middle layer's functionality, which means (at least for me) roughly the same level of debugging complexity when coming back to your own code later.
Both nginx and Apache have modules that keep a Python/PHP/Perl interpreter loaded and invoke your entry point using FastCGI, completely leaving HTTP handling to the real web server. They went out of style for some reason, but there’s nothing stopping you from using them.
Re:A Modern Web App in C
by fodkodrasz on Tuesday October 13, 2026 @02:17AM
(#50067508)
Some reason: isolation and economies of scale. Apart from the obvious security aspects imagine the situation that you are serving multiple applications, developed by different teams, on different roadmaps... and you need to do a major version update of the runtime. This strong coupling of application lifecycles makes the overhead of isolation worth it.
A typical setup today looks like:
nginx -> puma/unicorn/gunicorn/etc -> your code
With cgi that middle layer is gone. It's just:
nginx -> your code
The layer reduction is nice when it comes to things like debugging. You don't have to guess if the middle server is removing a header, failing to forward a header, etc.
It's obvious who does that with cgi.