Forum Discussion
Maria_Ramirez_5
Nimbostratus
Mar 29, 2006FINDING A STRING IN HTTP HEADER
Hello,
I AM IN A HURRY:
I am not used in iRules and I have the need of creating a simple iRule. The iRule has to do the following:
We have to find the word "bid=" in the HTTP Header. If the word is found, we have to load balance traffic. If the word is not found, we do not do anything with the traffic.
The word "bid=" has 4 characters (letters). We have to look for it in the http header, from the 1st character, to the 800th character.
The problem is that we do not have very clear what is the starting string where we can start to find.
Could you provide me an example that solves this issue...A schema???
THANK YOU IN ADVANCE!!
María
- JRahm
Admin
Try this:when HTTP_REQUEST { HTTP::collect 800 } when HTTP_REQUEST_DATA { if { [HTTP::payload] contains "bid=" } { use pool } else { discard } }
- Can you specify what HTTP Header the content will be in? Are you sure you don't mean that "bid=" is in the URI? If it is in the URI (ie. http://www.foo.com/somepage.cgi?bid=4&something_else).
when HTTP_REQUEST { if { [HTTP::uri] contains "bid=" } { pool some_pool } else { discard } }
when HTTP_REQUEST { if { [HTTP::header "HeaderName"] contains "bid=" } { pool some_pool } else { discard } }
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