Forum Discussion
Vishal_96707
Nimbostratus
Mar 03, 2009Bypass iRule for specific IP
I have following iRule configured for sharepoint app which redirects to a different site when you get "404" or "File Not Found" error. I want to have a configuration in which the certain ip will bypass the iRule. Even if this specific ip gets "404" or "File Not Found" it is OK.
Also how do you use IP address match in HTTP request? I believe i will have to use TCP events.
when HTTP_REQUEST {
set MYHOST [HTTP::host]
set MYURI [HTTP::uri]
}
when HTTP_RESPONSE {
log local0. "HTTP Status code is [HTTP::status] and Content Length is ([HTTP::header value "Content-Length"])"
if {([HTTP::status] == 404)} then {
log local0. "Found HTTP Status [HTTP::status] and the uri is $MYHOST $MYURI Redirecting"
HTTP::redirect "url"
} elseif { ([HTTP::payload] contains "File Not Found") or ([HTTP::payload] contains "404 NOT FOUND") } then {
log local0. "Page Content: [HTTP::payload]"
HTTP::redirect "url"
}
}
- benoit_9199
Nimbostratus
- hoolio
Cirrostratus
As benoit suggests, you can use TCP:: and IP:: commands in an HTTP event. The reverse is not always true. For example the HTTP headers have not been parsed by the time CLIENT_ACCEPTED is triggered so you cannot use HTTP:: commands in CLIENT_ACCPEPTED. - Vishal_96707
Nimbostratus
sorry i am not expert in programming. Can you help me building other logic? - benoit_9199
Nimbostratus
Hi,if { not [matchclass [IP::remote_addr] equals $::serversIpClass] } { if {([HTTP::status] == 404)} then { HTTP::redirect "url" } elseif { ([HTTP::payload] contains "File Not Found") or ([HTTP::payload] contains "404 NOT FOUND") } then { HTTP::redirect "url" } } }
- Vishal_96707
Nimbostratus
Thanks guys for all your help. I manage to resolve the search crawl issue by bypassing idex server hitting redirection iRule.
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