Hi.

Am 11.10.2018 um 10:05 schrieb Alfredo De Luca:
> Hi all. 
> Not sure how to do this but I need to limit a file size to be uploaded on our
> haproxy (HA-Proxy version 1.5.18).

Maybe you can use a newer version on your centos via this repo.
https://haproxy.hongens.nl/

> This is what I ve done so far... but not sure it's the right thing to do.
> 
> 
> acl fileweightlimit hdr_val(content-lenght) gt 104857600
                                      ^^^^^typo

acl fileweightlimit hdr_val(content-length) gt 104857600

This works only when the content-length is in the header, is the field there?
You can log the header value via

capture request  header Content-Length len 10

as documented here
https://cbonte.github.io/haproxy-dconv/1.5/configuration.html#8.8

>   acl hdfsupload hdr(host) <site> and path_beg /hdfs/proxy

I would separate this in two lines

acl hdfsupload hdr(host) <site>
acl hdfpath path_beg /hdfs/proxy

>   http-request deny if hdfsupload fileweightlimit

full snippet.

###
capture request  header Content-Length len 10

acl fileweightlimit hdr_val(content-length) gt 104857600
acl hdfsupload hdr(host) <site>
acl hdfpath path_beg /hdfs/proxy

http-request deny if hdfsupload fileweightlimit hdfpath
###

> Cheers
> 
> -- 
> /*Alfredo*/

Regards
Aleks

Reply via email to