Forum Discussion
F5 iRule for Header insert
Hi eLeCtRoN do you also have a header named XXX#YYYY? If not, then that's going to be an empty value anyway. If you are trying to:
- Assure the x-id header exists
- Assure that the x-id header has a value
Then, something like this should work for you:
when HTTP_REQUEST priority 500 {
if { [HTTP::header exists x-id] && ([HTTP::header x-id] == "") } {
HTTP::header replace x-id "some value here"
} else {
HTTP::header insert x-id "some value here"
}
}
if you don't need the header to be there then you can eliminate the else statement altogether.
Hi Jason,
just short tell you what I have, I have form the application the header x-id with no value inside (empty), so my WAF policy don't like that and block the request, what I now want to do is just to set a value inside the header x-id. Thanks for your response
- JRahmFeb 15, 2024
Admin
then that should work for you as is, or without the else block.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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