> ## Content Index
> Fetch the complete content index at: https://ostreff.info/llms.txt
> Use this file to discover other available public pages before exploring further.

# Use different backend depending on access-request hostname with HAProxy
- URL: https://ostreff.info/use-different-backend-depending-on-access-request-hostname-with-haproxy/
- Published: 2024-10-25T08:58:36.000Z
- Updated: 2024-10-25T08:58:36.000Z
- Author: Jordan Ostreff
- Tags: HAProxy

```bash
frontend frontend_main
...
use_backend %[req.hdr(host),lower,map(/usr/local/etc/haproxy/subdomains.map,backend_default)]
```

he content of `/usr/local/etc/haproxy/subdomains.map` would look like this:

```bash
#domainname  backendname
one.example.com backend_one
two.example.com backend_two
...
etc.domain1.com backend_etc
```