# How to make haproxy send http 404 when no acl get matched

**URL:** <https://discourse.haproxy.org/t/how-to-make-haproxy-send-http-404-when-no-acl-get-matched/2900>\
**Category:** Help!\
**Created:** [August 22, 2018, 9:53am UTC](https://discourse.haproxy.org/t/how-to-make-haproxy-send-http-404-when-no-acl-get-matched/2900 "2018-08-22T09:53:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![modamod](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/modamod/32/583_2.png) [@modamod](https://discourse.haproxy.org/u/modamod)\
**Post date:** [August 22, 2018, 9:53am UTC](https://discourse.haproxy.org/t/how-to-make-haproxy-send-http-404-when-no-acl-get-matched/2900/1 "2018-08-22T09:53:53Z")

</div>

I have 2 backend one for api and one for admin each has its own ACL that get matched and sends the request to the proper backend, the problem is I want any other url that doesnt fall under those ACLs to get http 404, the apps do not cover this so is there a way to do it in HAproxy ?

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [August 22, 2018, 1:53pm UTC](https://discourse.haproxy.org/t/how-to-make-haproxy-send-http-404-when-no-acl-get-matched/2900/2 "2018-08-22T13:53:58Z")

</div>

You can create a new backend without any server (which will cause a 503 error), and use a custom 503 errorfile for this, generating the 404 error (custom error files include HTTP response and header, not just payload).

For example:

```
frontend www-in
 default_backend generate_404

backend generate_404
 errorfile 503 /etc/haproxy/generate_404.http

```

Than create that file as per [errorfile](https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#4-errorfile) docs.
