On Fri, May 15, 2015 at 05:28:24PM -0600, Shawn Heisey wrote:
> On 5/15/2015 4:40 PM, Cyril Bonté wrote:
> > Sometimes, you can use an interesting trick : do you know you can
> > declare several "defaults" sections ? It allows to declare a "defaults"
> > one for you "http" frontends/backends, and another one for the tcp ones.
> 
> Is that as simple as having a defaults section followed by frontends and
> backends doing http/https, then another defaults section with the tcp
> settings, followed by the frontends and backends for tcp?  Do all
> settings reset back to just what's in global for the second defaults
> section?

Absolutely. That's what is recommended when mixing HTTP and TCP settings,
or various customers' configs into a single file. Also the defaults
sections accept an optional name (which doesn't appear anywhere) but which
makes it quite convenient for the user. Example :

   defaults http
       mode http
       timeout client 10s
       timeout server 10s
       timeout connect 5s
       option forwardfor

   frontend http
       bind :80
       ... do something ...

   defaults http-long-polling
       mode http
       timeout client 1h
       timeout server 1h
       timeout connect 5s
       option forwardfor

   frontend http-lp
       bind :8080
       ... do something ...

   defaults tcp
       mode tcp
       timeout client 1m
       timeout server 1m
       timeout connect 5s

   frontend smtp
       bind :25
       ... do something ...

You probably get the idea.

Cheers,
Willy


Reply via email to