# Haproxy swallowing 500 errors

**URL:** <https://discourse.haproxy.org/t/haproxy-swallowing-500-errors/7322>\
**Category:** Help!\
**Created:** [January 25, 2022, 3:02pm UTC](https://discourse.haproxy.org/t/haproxy-swallowing-500-errors/7322 "2022-01-25T15:02:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaymz](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/jaymz/32/72_2.png) [@jaymz](https://discourse.haproxy.org/u/jaymz)\
**Post date:** [January 25, 2022, 3:02pm UTC](https://discourse.haproxy.org/t/haproxy-swallowing-500-errors/7322/1 "2022-01-25T15:02:02Z")

</div>

When I send a request to the backend server I get a 500 error. If I send the same request to the frontend it returns with a 502. I read another thread that said it was a retry error. I set the following settings explicitly in the config and it did not fix it.  
retries 0  
retry-on none  
option redispatch 0

I did find this error from the admin socket:  
[25/Jan/2022:09:49:28.095] backend dialog.aa1.proquest.com\_green (#10): invalid response  
frontend brokenfrontend (#8), server server201 (#1), event #0, src 123.234.123.234:36221  
buffer starts at 0 (including 0 out), 1055 free,  
len 15329, wraps at 16336, error at position 15323  
H1 connection flags 0x00000000, H1 stream flags 0x00004044  
H1 msg state MSG\_CHUNK\_SIZE(26), H1 msg flags 0x00001736  
H1 chunk len 0 bytes, H1 body len 0 bytes :

00000 HTTP/1.1 500 500\r\n  
00018 Date: Tue, 25 Jan 2022 14:49:27 GMT\r\n  
00055 Server: Apache/2.4.33 (Unix) OpenSSL/1.0.2k-fips\r\n  
00105 Set-Cookie: JSESSIONID=672A258FAAE1E17A6625F8499C7A3B6A-nm4.nt1; Path=  
00175+ /professional; Secure; HttpOnly\r\n  
— snip —  
15235 Content-Type: text/html;charset=UTF-8\r\n  
15274 Connection: close\r\n  
15293 Transfer-Encoding: chunked\r\n  
15321 \r\n  
15323 7ff0\r\n

---

<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:** [January 25, 2022, 4:41pm UTC](https://discourse.haproxy.org/t/haproxy-swallowing-500-errors/7322/2 "2022-01-25T16:41:51Z")

</div>

You have a extremely large amount of HTTP headers in this response, you are at 15k, so you likely hit the limit:

[http://cbonte.github.io/haproxy-dconv/2.4/configuration.html#3.2-tune.bufsize](http://cbonte.github.io/haproxy-dconv/2.4/configuration.html#3.2-tune.bufsize)

> If an HTTP request is larger than (`tune.bufsize - tune.maxrewrite`), HAProxy will  
> return HTTP 400 (Bad Request) error. **Similarly if an HTTP response is larger  
> than this size, HAProxy will return HTTP 502 (Bad Gateway).**

Bump `tune.bufsize` or reduce the HTTP headers in the response.

---

<div class="post-metadata">

**Author:** ![jaymz](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/jaymz/32/72_2.png) [@jaymz](https://discourse.haproxy.org/u/jaymz)\
**Post date:** [January 25, 2022, 5:56pm UTC](https://discourse.haproxy.org/t/haproxy-swallowing-500-errors/7322/3 "2022-01-25T17:56:51Z")

</div>

quick test after upping tune.bufsize to 128000 worked, thanks!
