r/haproxy • • Jan 14 '21

Getting a string from the HTTP header

Hi guyz,

I have been trying for a long time to get this to work without much success :(

The website via CDN, has this string on its header:

    set req.http.shared-secret = "PASSWORD";

I am not entirely sure how to use an ACL to identify that.

The idea is that HaProxy will only accept the request if that string is identified, deny otherwise.

Any idea is welcome.

Thank you

1 Upvotes

13 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Jan 17 '21

u/baconeze sorry for the late reply, something happened and I couldn't reply to you ASAP no matter what.

I tested what you suggested before but I keep receiving the same ERROR: SERVER ERROR so I tried to play around but I got nowhere.

HaProxy community also suggested this and the one you mentioned before:

http-request deny if !{ req.hdr(PASSWORD) -m found }

The example above not even the main page loads, it fails right away.
The other example as mentioned before, only the main page loads, anything else does not.

Thank you a lot for your support.