Forum Discussion

CGI's avatar
CGI
Icon for Altostratus rankAltostratus
Dec 19, 2013

Swedish characters in a irule

Hi i need a redirect rule for a swedish url containing the swedish character ä

 

when HTTP_REQUEST { if { [string tolower [HTTP::uri]] equals "www.xxx.se/berätta" } { HTTP::respond 301 Location "http://192.168.14.11" } }

 

Is this possible ? As is the the irule editor will not let me save it.

 

/Craig

 

3 Replies

  • The client should URL encode non-ascii characters. Can you try logging the [HTTP::uri] value to confirm this?

     

    Also, the [HTTP::uri] value will not typically include the host name.

     

    https://devcentral.f5.com/wiki/iRules.http__uri.ashx For the following URL:

     

    http://www.example.com:8080/main/index.jsp?user=test&login=check

     

    The URI is:

     

    /main/index.jsp?user=test&login=check

     

    Aaron

     

  • CGI's avatar
    CGI
    Icon for Altostratus rankAltostratus

    Hi i used the following in the end but it seems to be different depending on what browser you use, IE and firefox work but chrome does not.

     

    when HTTP_REQUEST { log local0. "Path = [HTTP::path]" if { [string compare "ber%C3%A4tta" [HTTP::path]] } { log local0. "Redirect to Satchi site" }

     

    HTTP::respond 301 Location "http://91.196.242.118" }

     

    /Craig

     

  • Don_Flinspach_1's avatar
    Don_Flinspach_1
    Historic F5 Account

    Any time I have to do anything with non-ASCII characters, I will also create a variable that’s a b64decode of a base64-encoded string and perform comparisons against that. Given the prevalence of UTF-8–capable browsers, it’s not unreasonable to expect them to send words in other languages’ character sets anymore.

     

    For example, set test_uri_1 [b64decode "YmVyw6R0dGE="]

     

    There’s a little front-end work done here, but I’ve had this work regularly.