Forum Discussion

Thomas_53413's avatar
Thomas_53413
Icon for Nimbostratus rankNimbostratus
Jun 02, 2017

iRule for URI 'Percent encoding' doesn't work

Hi Guys,

 

 

We use different iRules in the same VS with the same event triggers. This should be possible in SW-Vers. 12.1.2.

 

The functions are different, of course.

 

So the 1st iRule is generally installed in many VSn and the 2nd iRule is specifically only for one VS.

 

the problem:

 

in an URI of an http-request are represented European ASCII special characters with "Percent-encoding" (e.g. '%C3%9F' for character 'ß' or '%C3%BC' for character 'ü').

 

For the correct translation of ASCII special characters in the URI we use the 2nd iRule. We want to use the 'URI :: decode' function for correction.

 

We have the following problem:

 

It seems as if the rule works fine and the function is executed (I see the processing run in the log-file) but the request to the poolmember transfers the original uri ( I see this in the tcpdump and in the server-log-file).

 

What could be the issue? What's wrong on the setting?

 

Any ideas everyone?

 

  • The iRule:

     

    when HTTP_REQUEST {

     

    log local0. "Original-URI: [HTTP::uri]"

     

    log local0. "Decode-URI: [URI::decode [HTTP::uri]]"

     

    HTTP::uri [URI::decode [HTTP::uri]]

     

    log local0. "Ausgabe-URI: [HTTP::uri]"

     

    if { ( [HTTP::header Authorization] starts_with "Digest ," ) } {

     

    HTTP::header replace "Authorization" "Digest [string range [HTTP::header Authorization] 8 end]"

     

    }

     

    if { ( [HTTP::header Content-Type] equals "application/x-www-form-urlencoded" ) } {

     

    HTTP::header replace "Content-Type" "text/xml"

     

    }

     

    switch -glob [string tolower [HTTP::path]] {

     

    "/monitor/" {

     

    return

     

    }

     

    "/manager/" {

     

    reject

     

    }

     

    default {

     

    return

     

    }

     

    }

     

    }

     

    when HTTP_REQUEST_SEND {

     

    clientside {

     

    HTTP::header replace Host "[IP::server_addr]:[TCP::server_port]"

     

    }

     

    }

     

  • Logging the irule to the ltm-logfile:

     

  • Jun 2 08:17:06 inwclb26t2 info tmm4[22109]: Rule /Common/rule_url_rewrite_tui2-mbbservices04.audi-connect.de : Original-URI: /mbb/poi/v2/?key=K%C3%BCnstler&lan=de_DE&lat=48.7863736900761&lon=11.394827225496007&num=10&index=0&radius=500&session=8871223&hu_region=eu_rdw&implicitLocation=n

     

  • Jun 2 08:17:06 inwclb26t2 info tmm4[22109]: Rule /Common/rule_url_rewrite_tui2-mbbservices04.audi-connect.de : Decode-URI: /mbb/poi/v2/?key=Künstler&lan=de_DE&lat=48.7863736900761&lon=11.394827225496007&num=10&index=0&radius=500&session=8871223&hu_region=eu_rdw&implicitLocation=n
  • Jun 2 08:17:06 inwclb26t2 info tmm4[22109]: Rule /Common/rule_url_rewrite_tui2-mbbservices04.audi-connect.de : Ausgabe-URI: /mbb/poi/v2/?key=Künstler&lan=de_DE&lat=48.7863736900761&lon=11.394827225496007&num=10&index=0&radius=500&session=8871223&hu_region=eu_rdw&implicitLocation=n
  • Tcpdump towards poolmember:

GET /mbb/poi/v2/?key=K..nstler&lan=de_DE&lat=48.7863736900761&lon=11.394827225496007&num=10&index=0&radius=500&session=8871223&hu_region=eu_rdw&implicitLocation=n HTTP/1.1

 

User-Agent: JavaJ2ME Foundation Specification v1.1

 

Host: 10.242.80.61:18581

 

Connection: keep-alive

 

Authorization: Digest qop=auth, uri="/mbb/poi/v2/?key=K%C3%BCnstler&lan=de_DE&lat=48.7863736900761&lon=11.394827225496007&num=10&index=0&radius=500&session=8871223&hu_region=eu_rdw&implicitLocation=n", response="44ddd10666390112fa3a26f999e617ce", nc=00000005, username=" xxx ", opaque=" xxx ", realm="AudiT1Realm", nonce=" xxx ", algorithm="MD5", cnonce=" xxx "

 

Accept-Encoding: gzip

 

Cookie: LBCOOKIE=1028715018.38216.0000

 

Forwarded-Mandant: INET

 

X-Forwarded-Host: xxx

 

X-Forwarded-For: xxx

 

X-Forwarded-Proto: https

 

Thx in advance - Thomas

 

1 Reply

  • Hi,

     

    Why are you trying to "correct" the URL? ß is not a valid character in URI, so it must be encoded.

     

    if you insert such character, the request may be wrong...

     

    only US-ASCII (according to RFC 3986, not changed in RFC 6874 and 7320) are supported and non US-ASCII characters must be encoded.