Live data from Hacker News

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

agwa.name

11–20 of 107 posts

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

#12
post #6

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 th…

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. There are security issues, such as when different parsers could even disagree on where the boundaries of a request ends. Google for example has long wrapped HTTP into t…

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

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

#13
post #9

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

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...

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

#14
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.

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

#15

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 th…

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).

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

#16
post #7
post #2

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.

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.

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.

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

#17
post #13
post #9

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

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...

I'm not looking for anything. I use this now, and it works.

I don't really know anything about the FastCGI.

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

#18
post #4

Earlier quoted context omitted.

The end-to-end principle within a datacenter makes little sense and, as shown in the article, ends up enabling insecure behaviour.

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 b…

Can you recommend a reverse proxy that supports white-listing of headers? nginx doesn't seem to.

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

#19
post #16
post #7

Earlier quoted context omitted.

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.

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.

This is the way only if you're operating in a trusted environment (eg. homelab, intranet) or you're sticking CloudFlare or some other "reverse proxy as a service" in front of it. If you expose an embedded HTTP app server directly to the Internet you're almost guaranteed to get pwned, as the Internet has now become an extremely hostile place.

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

#20
post #16

Earlier quoted context omitted.

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.

This is the way only if you're operating in a trusted environment (eg. homelab, intranet) or you're sticking CloudFlare or some other "reverse proxy as a service" in front of it. If you expose an embedded HTTP app server directly to the Internet you're almost guaranteed to get pwned, as the Internet has now become an extremely hostile place.

Go's embedded HTTP server can handle it just fine: https://blog.gopheracademy.com/advent-2016/exposing-go-on-th...
Post reply on HN