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.

Are you using F5 version 11.0 or later?

Just refer to your data-group object without the prefix “$::” in your IF condition.

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”?

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.

Thank you! It works really good.