frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

FastCGI: 30 years old and still the better protocol for reverse proxies

https://www.agwa.name/blog/post/fastcgi_is_the_better_protocol_for_reverse_proxies
85•agwa•2h ago

Comments

tombert•1h ago
Interesting.

Most of the stuff I've done for reverse proxies has been pretty straightforward and just using the stuff built into Nginx, but I have to admit that it wouldn't have even occurred to me to use FastCGI if I needed something more elaborate.

I used FastCGI a bit about ten years ago to "convert" some C++ code I wrote to work on the web, but admittedly I haven't used it much since then.

nzeid•33m ago
Also, embedded servers are now much much much more popular. Stuff an HTTP server directly into your application and do whatever you gotta do without gateways.
agwa•10m ago
That is way! Unfortunately, sometimes you have to do path-based routing to different backends, and now you're back to needing a proxy between your clients and your applications.
nostrademons•1h ago
This is quite an interesting article for its omissions.

I remember the great FastCGI vs. SCGI vs. HTTP wars: I was founding a Web2.0 startup right at the time these technologies were gaining adoption, and so was responsible for setting up the frontend stack. HTTP won because of simplicity: instead of needing to introduce another protocol into your stack, you can just use HTTP, which you already needed to handle at the gateway. Now all sorts of complex network topologies became trivial: you could introduce multiple levels of reverse proxies if you ran out of capacity; you could have servers that specialized in authentication or session management or SSL termination or DDoS filtering or all the other cross-cutting concerns without them needing to know their position in the request chain; and you could use the same application servers for development, with a direct HTTP connection, as you did in production, where they'd sit behind a reverse proxy that handled SSL and authentication and abuse detection.

It also helped that nginx was lots faster than most FastCGI/SCGI modules of the time, and more robust. I'd initially setup my startup's stack as HTTP -> Lighttpd -> FastCGI -> Django, but it was way slower than just using nginx.

The use of HTTP was basically the web equivalent of the End-to-End Principle [1] for TCP/IP. It's the idea that the network and its protocols should be agnostic to what's being transmitted, and all application logic should be in nodes of the network that filter and redirect packets accordingly. This has been a very powerful principle and shouldn't be discarded lightly.

The observation the article makes is that for security, it's often better to follow the Principle of Least Privilege [2] rather than blindly passing information along. Allowlist your communications to only what you expect, so that you aren't unwittingly contributing to a compromise elsewhere in the network.

And the article is highlighting - not explicitly, but it's there - the tension between these two principles. E2E gives you flexibility, but with flexibility comes the potential for someone to use that flexibility to cause harm. PoLP gives you security, but at the cost of inflexibility, where your system can only do what you designed it to do and cannot easily adapt to new requirements.

[1] https://en.wikipedia.org/wiki/End-to-end_principle

[2] https://en.wikipedia.org/wiki/Principle_of_least_privilege

ragall•46m ago
The end-to-end principle within a datacenter makes little sense, and as shown in the article, ends up enabling insecure behaviour.
nostrademons•29m ago
It makes a lot of sense. Most large organizations are collections of independent teams, many of whom don't communicate with each other other than sending quarterly OKRs and status updates back to their VP. The E2E principle is what allows them to each do their thing, agnostic to what the other servers handling the request are doing, and then let higher levels of the organization reconfigure and provision the system based on the needs of the moment.

Large organizations have a well-known pattern for how to handle this tension between the E2E principle and the PoLP. It's a firewall. As per the E2E principle, this is a node in the system, usually placed near the outside, which is responsible for inspecting and sanitizing every request that enters the system. The input is untrusted external requests that may have arbitrary binary data. The output is the particular subset of HTTP that form valid requests for the server, sanitized to a minimal grammar and now trusted because you reject every packet that wasn't a well-formed request for your particular service. As an added bonus, now you can collect stats on who is sending these malformed requests, which lets you do things like DDoS protection or calling their ISP or contacting the FBI.

The article even admits this: the right solution to untrusted headers is to strip out everything you aren't explicitly expecting at the reverse proxy. If you didn't know True-Client-IP exists, don't pass it on. Allowlist and block everything by default, don't blocklist and allow everything by default.

kccqzy•38m ago
The HTTP semantics are useful for anyone developing a web app but the wire protocol of HTTP itself is awful. Multiplexing didn’t arrive until HTTP 2.0 for example, so using HTTP for communication between a reverse proxy and a backend is very wasteful. Google for example has long wrapped HTTP into their own Stubby protocol between their web frontends and application frontends (which would usually be called backends); it’s much faster and more featureful than using the HTTP wire protocol.
nostrademons•21m ago
Won't argue with that, but it's a classic example of "Worse is better" [1]. It was simple and "good enough". Being ubiquitous is often more important than being efficient.

Most of the arguments for using HTTP reverse proxying over FastCGI or SCGI came down to ubiquity. It let you do things (like connect directly to your app servers with a web browser) that you couldn't do with FastCGI.

[1] https://dreamsongs.com/RiseOfWorseIsBetter.html

shevy-java•15m ago
What I dislike about nginx is ... the documentation. I find it virtually useless because of that.

Sadly httpd went the way of "let's make the configuration difficult"; I abandoned it when they suddenly changed the configuration format. I could have adjusted, but I switched to lighttpd (and also, past that point I let ruby autogenerate any configuration format, so technically I could return to httpd, but I don't want to - I think people who develop webservers, need to think about forcing people to adjust to any new format. If there is a "simple" decision to willy-nilly switch the configuration format, perhaps enable e. g. yaml-configuration in ADDITION, so that we don't have to go through new if-clause config statements suddenly).

sscaryterry•40m ago
I've fought many battles with perl + windows + apache + FastCGI in a previous life. No thank you.
jollyllama•32m ago
Indeed. I'm sure that someone will butt in with "it's just a bad implementation!" but the whole bit about allowlisting communications will cause flashbacks in those of us who had all our PUT requests just quit working on an IIS server.
chasil•31m ago
The PHP/Apache configuration that is distributed in the Red Hat family is "FastCGI Process Manager" (FPM).

I don't know if anything else in the RHEL distributions use FastCGI.

  $ rpm -qi php-fpm | grep ^Summary
  Summary     : PHP FastCGI Process Manager
agwa•20m ago
What you're looking for is mod_proxy_fcgi, not FPM. It's included in Fedora's httpd-core package; I don't know about RHEL: https://packages.fedoraproject.org/pkgs/httpd/httpd-core/fed...
shevy-java•17m ago
I'd love for CGI to be updated, kind of merging what works and not really caring about what does not work. Getting a .cgi file to work on Linux is really easy. Naturally you get more leverage with e. g. rails, but there is also a lot more complexity and I really hate intrinsic complexity.

Zed 1.0

https://zed.dev/blog/zed-1-0
928•salkahfi•3h ago•313 comments

We need a federation of forges

https://blog.tangled.org/federation/
390•icy•4h ago•202 comments

FastCGI: 30 years old and still the better protocol for reverse proxies

https://www.agwa.name/blog/post/fastcgi_is_the_better_protocol_for_reverse_proxies
89•agwa•2h ago•14 comments

Ramp's Sheets AI Exfiltrates Financials

https://www.promptarmor.com/resources/ramps-sheets-ai-exfiltrates-financials
19•takira•44m ago•0 comments

Copy Fail – CVE-2026-31431

https://copy.fail/
9•unsnap_biceps•14m ago•1 comments

Online age verification is the hill to die on

https://x.com/GlennMeder/status/2049088498163216560
333•Cider9986•2h ago•210 comments

Third Editor Fired in Elsevier's Citation Cartel Crackdown

https://www.chrisbrunet.com/p/third-editor-fired-in-elseviers-citation
75•RigbyTaro•2h ago•23 comments

Soft launch of open-source code platform for government

https://www.nldigitalgovernment.nl/news/soft-launch-for-government-open-source-code-platform/
444•e12e•9h ago•110 comments

Cursor Camp

https://neal.fun/cursor-camp/
88•bpierre•2h ago•12 comments

An open-source stethoscope that costs between $2.5 and $5 to produce

https://github.com/GliaX/Stethoscope
68•0x54MUR41•3h ago•33 comments

Linux 7.0 Broke PostgreSQL: The Preemption Regression Explained

https://read.thecoder.cafe/p/linux-broke-postgresql
90•0xKelsey•3h ago•33 comments

How to Build the Future: Demis Hassabis [video]

https://www.youtube.com/watch?v=JNyuX1zoOgU
19•sandslash•4h ago•6 comments

Laws of UX

https://lawsofux.com/
13•bobbiechen•1h ago•1 comments

Rise of the Forward Deployed Engineer

https://www.hfsresearch.com/research/fde-optional-ai-flywheel-spin/
13•nipponese•1h ago•7 comments

Mistral Medium 3.5

https://mistral.ai/news/vibe-remote-agents-mistral-medium-3-5
241•meetpateltech•3h ago•138 comments

Making AI chatbots friendly leads to mistakes and support of conspiracy theories

https://www.theguardian.com/technology/2026/apr/29/making-ai-chatbots-more-friendly-mistakes-supp...
45•Cynddl•3h ago•33 comments

Show HN: A new benchmark for testing LLMs for deterministic outputs

https://interfaze.ai/blog/introducing-structured-output-benchmark
23•khurdula•2h ago•8 comments

GitHub – DOS 1.0: Transcription of Tim Paterson's DOS Printouts

https://github.com/DOS-History/Paterson-Listings
81•s2l•7h ago•4 comments

Stardex Is Hiring a Founding Customer Success Lead

https://www.ycombinator.com/companies/stardex/jobs/6GCK1HC-founding-customer-success-lead
1•sanketc•6h ago

Maryland becomes first state to ban surveillance pricing in grocery stores

https://www.theguardian.com/technology/2026/apr/29/maryland-grocery-stores-ban-surveillance-pricing
63•01-_-•1h ago•22 comments

Letting AI play my game – building an agentic test harness to help play-testing

https://blog.jeffschomay.com/letting-ai-play-my-game
90•jschomay•5h ago•18 comments

Bugs Rust won't catch

https://corrode.dev/blog/bugs-rust-wont-catch/
556•lwhsiao•16h ago•311 comments

Improving ICU handovers by learning from Scuderia Ferrari F1 team

https://healthmanagement.org/c/icu/IssueArticle/improving-handovers-by-learning-from-scuderia-fer...
44•embedding-shape•5h ago•43 comments

Ghostty is leaving GitHub

https://mitchellh.com/writing/ghostty-leaving-github
3230•WadeGrimridge•22h ago•957 comments

Before GitHub

https://lucumr.pocoo.org/2026/4/28/before-github/
617•mlex•21h ago•203 comments

How ChatGPT serves ads

https://www.buchodi.com/how-chatgpt-serves-ads-heres-the-full-attribution-loop/
462•lmbbuchodi•18h ago•319 comments

Why Software Needs a Third Loop [audio]

https://www.heavybit.com/library/podcasts/third-loop/ep-3-give-it-a-name-why-software-needs-a-thi...
5•mooreds•1h ago•0 comments

Show HN: Adblock-rust Manager – Firefox extension to enable the Brave ad blocker

https://github.com/electricant/adblock-rust-manager
71•electricant•6h ago•33 comments

Court Rules 2nd Amendment Covers Firearms Parts Good News Those Who Build Guns

https://cowboystatedaily.com/2026/04/28/court-rules-2nd-amendment-covers-firearms-parts-good-news...
67•Bender•2h ago•39 comments

The Abstraction Fallacy: Why AI can simulate but not instantiate consciousness

https://deepmind.google/research/publications/231971/
55•joshus•58m ago•61 comments