Forwarding part of application to new version with Haproxy

Sometimes you need roll out part of application (after code refactoring, as example) to prod. Here pretty easy way how to do it with Haproxy

Haproxy configuration
listen frontend_http
  bind *:80
  bind *:443 ssl crt /etc/haproxy/crt/ssl.pem
  mode http

  acl is_legacy_paths path_reg -i ^/(api|api_v1|v1).*
  acl is_legacy_method url_reg -i .*method=notify.*
  use_backend backend_new if is_new_paths is_new_method

  default_backend backend_main
In the end you need two backends - one is default (backend_main) with old servers pool and backend with new servers pool (backend_new)


Popular posts from this blog

Redis with failover replication

FreeRadius and Google Workspace LDAP