Forum Discussion
iraheel_135195
Apr 14, 2014Nimbostratus
iRule Redirect isnt working
I am new to iRules , i want to set a redirect for my webapp. So when a user hits wcp.xx.com/wxx he is redirected to pushdev.xx.com/wxx & below is the iRule i have in place
when HTTP_REQUEST {
...
Cory_50405
Apr 15, 2014Noctilucent
It isn't working because you are trying to compare the HTTP::host string to a full location (host + URI). Change your iRule to look like this:
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] equals "wcp.xx.com" and [string tolower [HTTP::uri]] starts_with "/wxx" } {
HTTP::redirect "https://pushdev.xx.com/[HTTP::uri]"
}
}
- iraheel_135195Apr 15, 2014NimbostratusPerfect thanks it works fine , is it possible i can do the URL masking with this ? So users can always see wcp.xx.com\wxx on the address bar
- PK_BhatiaApr 15, 2014Nimbostratusyou can use proxy pass for this ... https://clouddocs.f5.com/api/irules/proxypassv10.html
- iraheel_135195Apr 15, 2014Nimbostratuswow seems like i have to do some reading , is there any easier way ? Can i simply use an else command with the code above
- Cory_50405Apr 15, 2014NoctilucentProxyPass isn't necessary. You can use something like what is mentioned here: https://devcentral.f5.com/s/feed/0D51T00006i7Ti1SAE
- iraheel_135195Apr 15, 2014Nimbostratusthats correct , but in your post or the post you have attached doesnt contains the answer
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