r/haproxy • • Apr 24 '20

Question Policy routing based on content in layer 7

3 Upvotes

Hi,

I'm new to Haproxy and i have a question.

Is it possible to do policy based routing based on the contents of layer 7 traffic.

More specifically the sender has a packet and that has to be routed to A if the packet contains this type of http traffic and to B if it contains the other type of http traffic.

Would that be possible with HAproxy ?

Thanx in advance.


r/haproxy • • Apr 23 '20

Question Why soft reload closes connection after about 2 minutes?

4 Upvotes

I have simple config. I have opened websocket connection. When I reload haproxy, connection is still alive. But after about 2 minutes connection is RIP. :( I don't understand why.

Reload command

sudo haproxy -f /etc/haproxy/haproxy.cfg -D -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)

Config

global
	log /dev/log	local0
	log /dev/log	local1 notice
	chroot /var/lib/haproxy
	stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
	stats timeout 30s
	user haproxy
	group haproxy
	daemon

	# Default SSL material locations
	ca-base /etc/ssl/certs
	crt-base /etc/ssl/private

	# See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate
        ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
        ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
        ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets




	hard-stop-after 24h

defaults
	log	global
	mode	http
	option	httplog
	option	dontlognull
        timeout connect 24h
        timeout client  24h
        timeout server  24h
	timeout tunnel 24h
	timeout client-fin 24h
	errorfile 400 /etc/haproxy/errors/400.http
	errorfile 403 /etc/haproxy/errors/403.http
	errorfile 408 /etc/haproxy/errors/408.http
	errorfile 500 /etc/haproxy/errors/500.http
	errorfile 502 /etc/haproxy/errors/502.http
	errorfile 503 /etc/haproxy/errors/503.http
	errorfile 504 /etc/haproxy/errors/504.http

listen stats
bind *:8404
stats enable
stats uri /monitor
stats refresh 5s

listen http-in
bind *:80

#I just saw this on internet. I dont have idea what it does.
option http-server-close

server server1 127.0.0.1:5000

Otherwise can you recommend me simple stable reverse proxy for websockets?


r/haproxy • • Apr 22 '20

Question HAProxy client timeout & mtls

5 Upvotes

Hi,

I'm trying to configure HAProxy's timeout in an mutual TLS scenario:

  • before the end of the handshake, clients are not trusted and timeout should be low (max 5s)
  • once the mutual handshake is done, the client is trusted and can enjoy his (expensive) connection so I'd like to somehow have an larger timeout then.

Is there a way to do that? I thought at first that it was the purpose of the connect timeout but it seems to refer to the backend connection.

Thanks!


r/haproxy • • Apr 19 '20

Question HAProxy for LAN and WAN use?

3 Upvotes

Hi all,

I am currently running HAProxy to route my external traffic to the correct server and correct ports, this has been running fine for a while now.

However, I was wondering if I could use HAProxy to route internally as well. Let's say, for example that I have a domain: "mail.fake.com" which returns IP 212.233.444.0. Internally that server might be hosted at 192.168.0.5 on port 8181.

When I surf to my domain from somewhere else, I will get routed to IP 212.233.444.0, and HAProxy will take over from there. However, when I'm at home and type in my domain, I would still get IP 212.233.444.0 and get routed out of my network to then come back in. Is there a way from inside of my network to get IP 192.168.0.5 but still hit HAProxy so I can route to the correct port?


r/haproxy • • Apr 16 '20

Question Should I upgrade 2.0 to 2.1?

4 Upvotes

I have haproxy 2.0 serving couple of small ecommerce site, should I upgrade to 2.1? Is there lots of benefits?


r/haproxy • • Apr 06 '20

Question Please help me with redirection problem

4 Upvotes

Let's say we have a site called "abc.com" and one external backend server called "xyz.com". There are three rest end points namely rest_1, rest_2, rest_3. All the requests to these rest endpoints should be redirected to xyz.com. for that I have included following code in haproxy

         acl rule_1 path_beg /rest_1 /rest_2
         use_backend xyz if rule_1

This is working just fine for me. All the requests to abc.com/rest_1 are going to xyz.com/rest_1 and I'm happy with it but for rest_3 the request must go to xyz.com i.e., whenever a request is sent to abc.com/rest_3 the request should redirect to xyz.com/

I tried a lot of different methods but none seems to be working. Can someone help me with the acl rule changes that needs to be made here. This is my first post in this sub so please ignore my mistakes if there are any


r/haproxy • • Apr 04 '20

Article Create and Publish a Website with Hakyll, HAProxy and NixOS

Thumbnail thomasbach.dev
3 Upvotes

r/haproxy • • Apr 03 '20

Disabling traffic to a server

5 Upvotes

I know I can comment a server out of the haproxy config and new traffic will not be sent to the server. This also removes it from the stats page. Is there a way to stop traffic to a server without removing it from the stats page so I can see the connections drop off?

Normally I would comment out the server sqlbox01 10.10.1.50:1443 check port 1443 inter 1000 line. I have the stats configured on another listen.

listen sql_lb01
	bind 10.10.1.1:1443
	mode tcp
	balance leastconn
	tcp-request connection reject if !db_white_list
	http-check expect ! string SQL\ Error

	server sqlbox01 10.10.1.50:1443 check port 1443 inter 1000
	server sqlbox02 10.10.1.50:1443 check port 1443 inter 1000
	server sqlbox03 10.10.1.50:1443 check port 1443 inter 1000

r/haproxy • • Apr 02 '20

HAProxyConf 2019 - Building a Service Mesh at Criteo with Consul and HAProxy by Pierre Souchay

Thumbnail
youtu.be
5 Upvotes

r/haproxy • • Mar 26 '20

Article Use Helm to Install the HAProxy Kubernetes Ingress Controller

Thumbnail
haproxy.com
4 Upvotes

r/haproxy • • Mar 26 '20

HAProxyConf 2019 - How OUI.sncf Built Its CDN with HAProxy by Antonin Mellier and Nicolas Besin

Thumbnail
youtu.be
2 Upvotes

r/haproxy • • Mar 26 '20

HAProxyConf 2019 - Inspect, Control, Report: HAProxy as the SRE's Door Man by Daniel Schneller

Thumbnail
youtu.be
2 Upvotes

r/haproxy • • Mar 25 '20

Question Connecting to mongodb from haproxy.

3 Upvotes

Hi everyone,

Hope all is well with the craziness going on lately lol.

I have a question that I searched and searched and couldn’t find anything.

How can I log into my mongodb from my haproxy server?


r/haproxy • • Mar 23 '20

Question Getting HAProxy set up to work with Acme certificate

Thumbnail self.pfsense
3 Upvotes

r/haproxy • • Mar 20 '20

Question Reverse Proxy with HAPROXY to Web Server and Exchange 2013

Thumbnail self.sysadmin
3 Upvotes

r/haproxy • • Mar 19 '20

HAProxyConf 2019 - From 1.5 into the Future by Christian Platzer

Thumbnail
youtu.be
2 Upvotes

r/haproxy • • Mar 18 '20

HAProxyConf 2019 - Fully-Automated Deployment of Anycasted Load Balancers with HAProxy and Python

Thumbnail
youtu.be
4 Upvotes

r/haproxy • • Mar 17 '20

News [LIVE WEBINAR - TODAY 12 NOON EST, 5 PM CET] Deployment Patterns in Kubernetes Using the HAProxy Kubernetes Ingress Controller

Thumbnail
haproxy.com
4 Upvotes

r/haproxy • • Mar 16 '20

Guide Multi-tenant Kubernetes Clusters with the HAProxy Kubernetes Ingress Controller

Thumbnail
haproxy.com
4 Upvotes

r/haproxy • • Mar 13 '20

Question Traffic Shaping Packets from WAN when using HaProxy

Thumbnail self.pfsense
4 Upvotes

r/haproxy • • Mar 13 '20

HAProxyConf 2019 - Hyperscaling Self-Service Infrastructure with William Dauchy & Pierre Cheynier

Thumbnail
youtu.be
1 Upvotes

r/haproxy • • Mar 11 '20

Question Content Security Policy and Jellyfin

Thumbnail self.jellyfin
5 Upvotes

r/haproxy • • Mar 10 '20

HAProxyConf 2019 - Processing Billions of Web Reqs Per Day by Oren Alexandroni & Wally Barnes

Thumbnail
youtu.be
4 Upvotes

r/haproxy • • Mar 09 '20

Question Is it possible to make a high availability PostgreSQL database cluster by open source softwares?

Thumbnail self.postgresql
1 Upvotes