Forum Discussion
eLeCtRoN
Cirrus
Feb 12, 2024F5 iRule for Header insert
Hello, I create that iRule below, but my header value for the header x-id is still empty, what could be wrong ? when HTTP_REQUEST { foreach header_name [HTTP::header names] { if {([HTTP::header v...
JRahm
Admin
Feb 13, 2024Hi 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.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects