Adds domain based rate limiting to HAProxy for Pages

For https://gitlab.com/gitlab-com/gl-infra/reliability/-/issues/15689

This sets an optional domain based rate limit using HAProxy stick tables. By default the rate limit is off, once enabled we will default to 800 requests/second per domain.

A few things of note before reviewing this MR:

  • We now have frontend peers for Pages haproxy, this is necessary so that we can track the request rate across all nodes as a unit.
  • There are two frontends for pages, pages_http and pages_https. pages_https is a tcp frontend so we are unable to use the Host header. Instead we use req_ssl_sni which is the sni hostname.
  • Because pages_https is tcp we can't issue a nice 429 response, instead we issue a tcp-request content reject. this is not so nice on the browser. See https://gitlab.com/gitlab-com/gl-infra/reliability/-/issues/15689#note_939914641 .
  • Because ssl rejections are not tracked in status codes or any metric that I have been able to see, I moved these rejections into their own backends. This will allow us to track rejections at HAProxy specifically by looking at the session rate on the deny_https backend

Merge request reports

Loading