# 503 Error On hosts.map Config

**URL:** <https://discourse.haproxy.org/t/503-error-on-hosts-map-config/7767>\
**Category:** Help!\
**Created:** [June 20, 2022, 7:47am UTC](https://discourse.haproxy.org/t/503-error-on-hosts-map-config/7767 "2022-06-20T07:47:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dulux-Oz](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/dulux-oz/32/1727_2.png) [@Dulux-Oz](https://discourse.haproxy.org/u/Dulux-Oz)\
**Post date:** [June 20, 2022, 7:47am UTC](https://discourse.haproxy.org/t/503-error-on-hosts-map-config/7767/1 "2022-06-20T07:47:57Z")

</div>

Hi Guys & Girls,

Hoping someone can point me in the right direction:

We’re receiving a 503 error when we try to connect to a server (full details below) whose access is controlled by haproxy and a server map. However, if we connect to the backend server directly then everything is aok - so we think the error is in the haproxy conf file and/or the map file.

Any help would be greatly appreciated.

The servers:

- server1.domain.local - working fine
- server2.domain.local:5000 - working fine with direct connection
- server3 - alias for server2 but without the port (ie server3.domain.local:80)

The map file (hosts.map):

```auto
#front-ends #back-ends
server3.domain.local server3-redirect
doamin.local www-servers

```

The haproxy conf file (relevant parts):

```auto
frontend www
        bind *:80
        bind *:443 ssl crt '/etc/haproxy/ssl/*.ourdomain.com' crt /etc/haproxy/ssl/ ecdhe secp384r1 alpn h2,http/1.1
        acl acl_plain_http ssl_fc,not
        http-request redirect scheme https code 301 if acl_plain_http
        http-request redirect prefix http://www.ourdomain.com code 301 if { hdr(host) -i domain.com }
        http-response add-header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload;"
        http-request set-var(txn.host) req.hdr(host)
        use_backend %[req.hdr(host),lower,map_dom(/etc/haproxy/maps/hosts.map,www-servers)]
        default_backend www-servers

backend server3-redirect
        mode http
        option http-server-close
        cookie SERVERUSED insert indirect nocache
        http-request set-header X-Forwarded-Port %[dst_port]
        http-request add-header X-Forwarded-Proto https
        server server3 server2.domain.local:5000 cookie server3 check

backend www_servers
        mode http
        option http-server-close
        cookie SERVERUSED insert indirect nocache
        http-request set-header X-Forwarded-Port %[dst_port]
        http-request add-header X-Forwarded-Proto https
        server server1 server1.domain.local:80 cookie server1 check

```

Cheers

Dulux-Oz

---

<div class="post-metadata">

**Author:** ![Dulux-Oz](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/dulux-oz/32/1727_2.png) [@Dulux-Oz](https://discourse.haproxy.org/u/Dulux-Oz)\
**Post date:** [June 24, 2022, 7:30am UTC](https://discourse.haproxy.org/t/503-error-on-hosts-map-config/7767/2 "2022-06-24T07:30:46Z")

</div>

Issue Resolved: Bad hosts.map file - thanks everyone
