Hello list, I need to configure HAProxy to deny the request with 413 based on 
the value of the content-length header. This is my actual configuration:

    errorfile 400 /usr/local/etc/haproxy/errors/413.http
    http-request deny deny_status 400 if { req.body_size gt 10485760 }

This is working but sounds a hacky workaround since I’m using another status 
code. If I try to use:

    errorfile 413 /usr/local/etc/haproxy/errors/413.http
    http-request deny deny_status 413 if { req.body_size gt 10485760 }

... HAProxy complains with:

    [WARNING] 135/001448 (27) : parsing [/etc/haproxy/haproxy.cfg:15] : status 
code 413 not handled by 'errorfile', error customization will be ignored.
    [WARNING] 135/001448 (27) : parsing [/etc/haproxy/haproxy.cfg:89] : status 
code 413 not handled, using default code 403.

How should I configure HAProxy in order to deny with 413?

~jm


Reply via email to