Forum Discussion
Insert header
Hi everyone,
I am trying to insert an http header if the http query contains a certain word. Here is what I have:
when HTTP_REQUEST { if {[string tolower [HTTP::query]] contains "admin"} { log local0. "Header Inserted" HTTP::header insert SecureAdmin true } }
I have verified by the log that the query string is matching (and thus going into the if statement). However, the header doesn't seem to get inserted. I'm using LiveHttpHeaders to view and I'm not seeing the "SecureAdmin" header.
Can anyone help me out with what I'm missing?
Thanks!!!
1 Reply
- prdg-jason_1930
Nimbostratus
Disregard this. It works. LiveHTTPHeaders must just not work correctly. I added to the IRule:
when HTTP_REQUEST { if {[string tolower [HTTP::query]] contains "admin"} { log local0. "Header Inserted" HTTP::header insert SecureAdmin true foreach aHeader [HTTP::header names] { log local0. "$aHeader: [HTTP::header value $aHeader]" } }
and the log shows the header.
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