Live data from Hacker News

HAProxy 2.0

haproxy.com

111–120 of 120 posts

Re: HAProxy 2.0

#111

The conversation in this thread has made me wonder after reading it if anyone uses Apache2 as their webserver anymore. Edit: seems many still do! I thought it was dying slowly as php popularity was going down.

Yes. Any time I need to use cgi's, php, or anything where security outside of Apache can be controlled by an Apache module, I will always default to Apache as the security control story is better. Performance wise, Apache 2.4 using the latest APR libraries is equal to NGinx.

There are also far fewer bugs and updates to the Apache core. I rarely have to recompile anything.

I have also had many frustrating interactions with the lead developer of NGinx. There are many assumptions made and many things hard coded in the Makefile, especially as it pertains to pcre, zlib, openssl and CFLAGS, LDFLAGS, etc. Also, I can't just point to existing pcre and zlib deployments for inclusion. NGinx wants the source and to recompile the extra libraries each time.

Re: HAProxy 2.0

#112

I've always used Nginx as a proxy, but I've seen HAProxy mentioned, what are some of the benefits of using HAProxy over nginx as a proxy or load balancer?

What open-source NGINX lacks that open-source HAProxy has: * ACL rules with full support for logical if statements [1] * active health checks * end-to-end HTTP/2 [2] * Robust logging or a dashboard with metrics * The ability to read env variables * session stickiness * DNS service discovery [3] These are just things I'm aware of, there could be a lot more. HAProxy has shown itself to perform better for certain users…

Also

* Admin socket for live server adds/removes

* Full header manipulation without compiling extra modules

Broadly speaking, HAProxy is a more fully-featured choice for a HTTP/TCP/UDP load balancer.

However, it is not a web server, as it lack file serving and caching abilities.

Re: HAProxy 2.0

#113

Earlier quoted context omitted.

> As of RIGHT NOW, haproxy has not updated it's official docker image and has 6 day old docker images which docker hub flags as having vulnerabilities (screenshot at https://imgur.com/a/SiYoZzc ). So I'm a little hesitant at calling this release "Cloud Native" 1. The “official” Docker image is not maintained by HAProxy itself. “Official” refers to being blessed by Docker. See: https://github.com/docker-library/offici…

in which case is there your own registry where you maintain docker images ? I'm not trying to be an ass. I've been looking forward to haproxy to be more docker/k8s/cloud friendly. This release claims so, but how do I deploy to k8s now ? should everyone be compiling their own images ? If haproxy is not able to support official docker images, then we are back in "let's just use nginx. they atleast have official images"…

The "official" HAProxy docker builds are strictly controlled by the Docker team. For builds created directly by HAProxy Technologies you can find them here: https://hub.docker.com/u/haproxytech

Re: HAProxy 2.0

#114

Earlier quoted context omitted.

Of course, for anything that is cgi/fastcgi. nginx doesn't support that. There is also stuff running on mod_php/mod_python/mod_wcgi that is bound to apache, however these are deprecated and unstable technologies that should not be used in this decade.

nginx supports fast cgi https://www.nginx.com/resources/wiki/start/topics/examples/f... I imagine it supports cgi calls too

Reading that documentation page will tell you that nginx cannot spawn fastcgi processes ;)

Re: HAProxy 2.0

#115

Earlier quoted context omitted.

nginx supports fast cgi https://www.nginx.com/resources/wiki/start/topics/examples/f... I imagine it supports cgi calls too

Nginx does not support CGI, but you can for example use uWSGI as a application server behind nginx.

For reference, WSGI is python only, it's an interprocess communication method very similar to fastcgi with the same purpose.

Re: HAProxy 2.0

#116

Can HA proxy serve static files like nginx?

It can proxy and cache them.

There is a hacky way to serve single page static files directly via haproxy, by creating a http file (including headers) and add it to a custom back-end. This is really only useful if you have one or two pages you need to serve and don't want to run another web server. Some people use this for outage or maintenance pages.

    acl landing path_beg /demo
    use_backend landing if landing

    backend landing
        mode http
        fullconn        10000
        errorfile 503 /opt/ha/landing_page.http
        http-request    set-log-level silent


    # cat landing_page.http

    HTTP/1.1 200 Ok
    Cache-Control: no-cache, no-store
    Connection: close
    Content-Type: text/plain

    This is a static text file served directly from HAproxy 1.9

    I will catch grief for showing this.

Then use acl's to send specific requests to that page. Obviously change/add headers as required for the content in the file and use-case. Perhaps useful for outage or maintenance pages. Use your imagination for other use cases where you might want to automatically serve such a page.

Here it is in use: [1]

[1] - https://tinyvpn.org/demo

Re: HAProxy 2.0

#117
post #98

Earlier quoted context omitted.

To be fair to squid and nginx, they don't do the same things. Squid is mainly a forward proxy. Nginx is mainly a web server. There's no reason for not using them anymore for these use cases where they excel.

I use haproxy as a forward proxy on my personal computers mainly for ability to control SSL options, sniffing SSL traffic and to support non-SSL enabled clients. I do not need any caching so squid seems inappropriate.

s/non-SSL/non-SNI/

Re: HAProxy 2.0

#118

Earlier quoted context omitted.

Nginx does not support CGI, but you can for example use uWSGI as a application server behind nginx.

For reference, WSGI is python only, it's an interprocess communication method very similar to fastcgi with the same purpose.

Seems like it can work with others too, though I don't know how well: https://uwsgi-docs.readthedocs.io/en/latest/LanguagesAndPlat...

Re: HAProxy 2.0

#119

I've always used Nginx as a proxy, but I've seen HAProxy mentioned, what are some of the benefits of using HAProxy over nginx as a proxy or load balancer?

Nginx is a web server that happens to have reverse proxy functionality (similar to Apache).

HAProxy is a load balancer with philosophy of "do one thing and do it well".

Perhaps things changed with nginx, but when I tried it for load balancing it was very basic, it didn't even have status page or health checks unless you purchased the commercial version. It only had round robin load balancing method etc.

If your goal is load balancing haproxy is far superior, if your goal is to have a web server that hosts some static files and then redirect dynamic requests to another app then nginx might be better.

Re: HAProxy 2.0

#120
post #43

Earlier quoted context omitted.

In my previous company we used to use HAProxy, and it was a hassle. Yes, it is powerful. However, nginx is way easier to configure and set up, and performance wise is a contender for most usual applications people needed. Maybe for a few edge cases, HAProxy works better, but overall, I'd pass on it. nginx just fulfills most people's requirements for reverse proxy and has solid HTTP/2 support (and other features) for…

Crazy, HAProxy is free, will proxy and load balance anything not just HTTP, and it's absolutely trivial to configure and install; there's nothing remotely complicated about setting it up. Most importantly for trivial offloading of certificates at the edge; even if using nxinx for your app servers, you should front end it with HAProxy. nxinx just doesn't compare and isn't free. Nxinx is a web server, haproxy is a tcp/…

Why do you say nginx is not free? If anything, nginx is more free than HAProxy (that has a viral license).
Post reply on HN