Forum Discussion
iRule not parsing correctly... hidden spaces?
Pulling hair out on this one.... trying to find a hidden space? Trailing space? Bad juju?
When inputting this iRule straight from Notepad++ - I get this nasty bit of NON-HELPFUL information:
01070151:3: Rule [/Common/site1.abc.com_redirect2] error: /Common/site1.abc.com_redirect2:1: error: [undefined procedure: When][When HTTP_REQUEST { Switch –glob [string tolower [HTTP::uri]] { “/” {HTTP::redirect "; } “/v2” {HTTP::redirect "; } default { do nothing } } }]
The actual iRule is this:
When HTTP_REQUEST { Switch –glob [string tolower[HTTP::uri]] { “/” {HTTP::redirect "; } “/v2” {HTTP::redirect "; } default { do nothing } } }
Any help is much appreciated.
- Kevin_Davies
Nacreous
When should be when. It should be in lowercase.
- RossVermette
Nimbostratus
I think the notepadd ++ is getting rid of some CR/LF characters.
Try this for iRule:
when HTTP_REQUEST { switch -glob[string tolower [HTTP::uri]] { "/" { HTTP::redirect "http://site1.abc.com/main" } "/v2" { HTTP::redirect "http://site1.abc.com/second/api/v2" } default { log0.notice "do nothing" } } }
- Lee_Sutcliffe
Nacreous
I've removed the capitalisation, semi-colons and for some reason the hyphen used before -glob wasn't the correct character:
when HTTP_REQUEST { switch -glob[string tolower [HTTP::uri]] { "/" { HTTP::redirect "http://site1.abc.com/main" } "/v2" { HTTP::redirect "http://site1.abc.com/second/api/v2" } default { log0.notice "do nothing" } } }
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