Difference between frontend/backend and listen in haproxy
Asked Answered
E

1

47

Hopefully a simple question. I apologize if this has been covered before. I'm learning haproxy and overall seems very straightforward and simple. However I am curious what the difference is between using frontend/backend and listen config blocks? My assumption is that listen is just simpler, for basic configurations, while frontend/backend is more advanced, allowing you to dynamically switch backends or share backends, etc. Is that it in a nutshell?

Thanks,

Al

Engdahl answered 29/8, 2016 at 15:28 Comment(1)
Please accept an answer if it answered your question.Usurpation
G
57

All three are called "proxies."

A listen is a combined frontend and backend. A listen has an implicit default_backend of itself, but the frontend logic of a listen can use other backends and its backend section can be used by other frontends. Fundamentally it just keep configuration more compact for simple rules, but otherwise it's almost the same as declaring a separate frontend and backend of the same name, while keeping the config together.

A "listen" section defines a complete proxy with its frontend and backend parts combined in one section. It is generally useful for TCP-only traffic.

http://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4

It's paricularly useful for TCP because such configurations are usually simpler than HTTP. But a listen proxy can be used for either application.

Grower answered 29/8, 2016 at 19:7 Comment(1)
Makes sense. Thank you!Engdahl

© 2022 - 2024 — McMap. All rights reserved.