# Http-response set-map usage

**URL:** <https://discourse.haproxy.org/t/http-response-set-map-usage/9293>\
**Category:** Help!\
**Created:** [December 6, 2023, 3:19am UTC](https://discourse.haproxy.org/t/http-response-set-map-usage/9293 "2023-12-06T03:19:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![newtohaproxy](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@newtohaproxy](https://discourse.haproxy.org/u/newtohaproxy)\
**Post date:** [December 6, 2023, 3:19am UTC](https://discourse.haproxy.org/t/http-response-set-map-usage/9293/1 "2023-12-06T03:19:24Z")

</div>

Hello. Newish to HAProxy and having some difficulty. I have a backend and want the destination ip and backend name added to a map file if the status code is 404. Backend configuration is very simple:

```auto
backend MyBackend
    server my_server 127.0.0.1:5555
    http-response set-map(/path/to/my.map) %[dst] MyBackend if { status 404 }

```

I’ve verified that the map is recognized by HAProxy via the runtime api:

```auto
echo “show map” | socat stdio /path/to/haproxy.sock

```

The map shows up in the output.

However, I am trying to read it at runtime with the Golang client-native runtime client. I have a goroutine set to check it every n seconds. But I always get an error re: “cannot parse json”, essentially saying it’s empty.

The file does start empty, but I am hoping to add to it via the above.

Any ideas as to where I am going wrong would be appreciated.

For what it’s worth, if I change the http-response line to:

```auto
http-response set-header x-not-found true if { status 404 }

```

It does add the header on the response. Thanks for reading.
