# Haproxy http code

**URL:** <https://discourse.haproxy.org/t/haproxy-http-code/4737>\
**Category:** Help!\
**Created:** [January 16, 2020, 6:22pm UTC](https://discourse.haproxy.org/t/haproxy-http-code/4737 "2020-01-16T18:22:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![watcher666](https://avatars.discourse-cdn.com/v4/letter/w/8e7dd6/32.png) [@watcher666](https://discourse.haproxy.org/u/watcher666)\
**Post date:** [January 16, 2020, 6:22pm UTC](https://discourse.haproxy.org/t/haproxy-http-code/4737/1 "2020-01-16T18:22:02Z")

</div>

Hello

My config haproxy.cfg

frontend sait  
bind \*:7030

```
acl hdr_sait hdr_beg(host) -i sait.ru
acl status_404 status 404
http-response set-header Location https://sait.ru/ErrorPages/404_ru.html if status_404
http-response set-status 302 if status_404

acl status_5xx status 500 502 503 504
http-response set-header Location https://sait.ru/ErrorPages/503.html if status_5xx
http-response set-status 302 if status_5xx

```

acl path\_4 path\_beg /ErrorPages/  
use\_backend bknd\_nginx if hdr\_sait path\_4  
use\_backend bknd\_tomcat if hdr\_sait

how can I make sure that the correct http codes 404, 503,500 are given to a higher-standing server. And not 302 ?

I’ve been here so that only nginx does this, but the config test shows warning

frontend sait  
bind \*:7030

```
acl hdr_sait hdr_beg(host) -i sait.ru
acl status_404 status 404
acl status_5xx status 500 502 503 504

```

use\_backend bknd\_nginx if hdr\_sait status\_404  
use\_backend bknd\_nginx if hdr\_sait status\_5xx  
use\_backend bknd\_tomcat if hdr\_sait

acl ‘status\_404’ will never match because it only involves keywords that are incompatible with ‘frontend use-backend rule’

---

<div class="post-metadata">

**Author:** ![Baptiste](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@Baptiste](https://discourse.haproxy.org/u/Baptiste)\
**Post date:** [January 17, 2020, 10:35pm UTC](https://discourse.haproxy.org/t/haproxy-http-code/4737/2 "2020-01-17T22:35:06Z")

</div>

`use_backend` is a client-\>server feature and `status` is a fetch which works on the way server-\>client.  
In other terms, you can’t use a “response phase” feature at request time

---

<div class="post-metadata">

**Author:** ![watcher666](https://avatars.discourse-cdn.com/v4/letter/w/8e7dd6/32.png) [@watcher666](https://discourse.haproxy.org/u/watcher666)\
**Post date:** [January 18, 2020, 7:23am UTC](https://discourse.haproxy.org/t/haproxy-http-code/4737/3 "2020-01-18T07:23:46Z")

</div>

Are there any ways to change 302 to 404?
