Forum Discussion
Irule not working to insert header value when we issue URI redirect in different irule as below
Irule not working to insert header value when we issue URI redirect in different irule as below.
Rule 1:-irule.x-forwarded-for.fix when HTTP_REQUEST { if {[HTTP::header exists True-Client-IP] } { HTTP::header insert WL-Proxy-Client-IP [HTTP::header value True-Client-IP] } else { HTTP::header insert WL-Proxy-Client-IP [IP::client_addr] }
Rule2:- irule.site.maintenance:- when HTTP_REQUEST {
Set value to 1 if auto mobile maintenance required. Set value to 0 If there is no auto mobile maintenance required. Default Value is 0.
set mobile_maintenance_prod 1
if { $mobile_maintenance_prod==1 } { switch -glob [string tolower [HTTP::path]] { "/abc/*" { set json "{ "Maintainance Message" } HTTP::respond 200 content $json "Content-Type" "application/json"; event disable; unset json; }
/Uri1* /Uri2* /ur3* { HTTP::redirect "/auto/site-unavailable/index.html"; event disable; } } } }
Note:-Please dont blame for bracing issues.
1 Reply
- nitass
Employee
header insertion and http redirection should not be triggered on the same request, shouldn't they? you can disable event after either action is executed using event command. event https://clouddocs.f5.com/api/irules/event.html alternatively, you may do header insertion in HTTP_REQUEST_SEND instead (of HTTP_REQUEST). HTTP_REQUEST_SEND https://clouddocs.f5.com/api/irules/HTTP_REQUEST_SEND.html
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