Forum Discussion
redirect certain uri to HTTPS
Dear team,
I am getting confused with the error below.
Could you tell me what is wrong with my iRule or data group?
TCL error: /Common/RedirectToHTTPS - can't read "::RedirecttoHTTPSURI": no such variable while executing "class match [string tolower [HTTP::uri]] equal s $::RedirecttoHTTPSURI"
which made from following iRule"RedirectToHTTPS"
when HTTP_REQUEST { log local0. "[IP::client_addr] -> [HTTP::host][HTTP::uri][HTTP::header User-Agent]"
if { ([class match [string tolower [HTTP::uri]] equals $::RedirecttoHTTPSURI] ) } {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
example of data group "RedirecttoHTTPSURI" is following,
String: /p/x/yyy/zzz/index.html
Value: /p/x/yyy/zzz/index.html
I really appreciate with your help.
4 Replies
- Hannes_Rapp
Nimbostratus
Are you using F5 version 11.0 or later?
Just refer to your data-group object without the prefix "$::" in your IF condition.
- Mick39_201768
Nimbostratus
Hannes, Thank you for your help.
In addition, I have a question.
If I want to distinguish Uppercase and Lowercase, what can I use instead of "string tolower"?
- Hannes_Rapp
Nimbostratus
Replace "[string tolower [HTTP::uri]]" with "[HTTP::uri]". Just a quick note to let you know, you don't have to define values for your entries in your data-group. Consider the "value" field as a comment field in your use context. Matching will occur based on the "string" value you set, the "value" field can be empty. Cheers. - Mick39_201768
Nimbostratus
Thank you! It works really good.
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