Forum Discussion
Problem with multiple redirects in irule
Hi anyone suggest how this irule could work better iam having problems with it at the moment too many redirects and the syntax is not that great.
when HTTP_REQUEST { if { [HTTP::uri] contains "/PUTV1-" } { set host [string map {vodrr-stage.site.se stage.site.se} [HTTP::host]] log local0. "Incoming URI = [HTTP::uri]" if { [string tolower [HTTP::uri]] starts_with "/vod" } { set uri [string map {"/vod" "/nPVR"} [HTTP::uri]] log local0. "New URI = $uri" HTTP::uri $uri }
HTTP::redirect "http://$host[HTTP::uri]"
} else {
set host [string map {vodrr-stage.site.se cu.site.se} [HTTP::host]]
HTTP::redirect "http://$host[HTTP::uri]"
}
}
/Thanks Craig
2 Replies
- Renato
Altostratus
May you repost your code with the code block delimiters (~~~)? - nitass
Employee
can you try something like this?
when HTTP_REQUEST { if { [HTTP::uri] contains "/PUTV1-" } { set host [string map {vodrr-stage.site.se stage.site.se} [HTTP::host]] if { [HTTP::uri] starts_with "/vod" } { set uri [string map {"/vod" "/nPVR"} [HTTP::uri]] HTTP::redirect "http://$host$uri" return } HTTP::redirect "http://$host[HTTP::uri]" } else { set host [string map {vodrr-stage.site.se cu.site.se} [HTTP::host]] HTTP::redirect "http://$host[HTTP::uri]" } }
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