Forum Discussion
HTTP request to allow specific header
Hello guys.
I'm new to irules, I was looking for some irule that only allows a specific header to access the application, if you don't have this header allowed it will drop this connection attempt. Tried something along those lines, but VS doesn't have persistence.
when HTTP_REQUEST { if { [HTTP::header exists "Header_name"]} { persist uie [HTTP::header "Header_name"] } }
If anyone can help please? Thanks.
- PeteWhiteEmployee
when HTTP_REQUEST { if { ! [HTTP::header exists "Header_name"] } { drop } }
- EduardoSousaAltocumulus
Hello Pete,
Yes that's what I want, I'll do one more test, thanks.
- EduardoSousaAltocumulus
Hi PeteWhite.
Thanks for the help, but this irule will drop the header I want to allow. Instead of drop, it would be allow, I tried to change the drop, but it didn't work.
- PeteWhiteEmployee
Hi Eduardo,
The iRule i added above will drop any HTTP requests which don't have the specified HTTP header. Is that not what you wanted?
- EduardoSousaAltocumulus
Hello Pete.
Is it possible to change the Irule to read the value and the header? For example, name = X-Custom-header and value = "ABCDEF123456"
- PeteWhiteEmployee
when HTTP_REQUEST { if { (! [HTTP::header exists "Header_name"]) || ([HTTP::header value "X-Custom-header" != "ABCDEF123456) } { drop } }
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com