Forum Discussion
URL Redirect help needed in iRule with path forwarding
Hi,
I'm trying to do a redirect from a DNS name to a web URL. As an example I want to type in home.example.com to redirect to https://apps.google.com/user/hub using the F5 iRules.
I've tried the following but get a syntax error:
when HTTP_REQUEST { if {[HTTP::host] eq “home.example.com”}{
Send 302 redirect to the new location
HTTP::redirect https://apps.google.com/user/hub } }
4 Replies
- sberhorst_30626
Nimbostratus
This is the snippet of code. Original message was butchered.
when HTTP_REQUEST { if {[HTTP::host] eq “home.example.com”}{ HTTP::redirect https://apps.google.com/user/hub } }
- sberhorst_30626
Nimbostratus
Here is the error response:
01070151:3: Rule [/Common/Home_Redirect] error: /Common/Home_Redirect:2: error: [parse error: PARSE syntax 40 {syntax error in expression "[HTTP::host] eq “home.exmaple.com”": unexpected operator &}][{[HTTP::host] eq “home.example.com”}]
- Vijay_E
Cirrus
Edited the previous iRule:
when HTTP_REQUEST { if { [HTTP::host] eq "home.example.com" } { HTTP::redirect "https://apps.google.com/user/hub" } } - jgranieri
Nimbostratus
you can use HTTP Local Policy to accomplish the same thing.
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