Forum Discussion

Mic_108850's avatar
Mic_108850
Icon for Altostratus rankAltostratus
May 05, 2010

irule and '%23' in URL

Hi,

 

 

I'm using the following irule to redirect some requests :

 

 

if { not([findstr $ParsedURI "redirect.jsp"] eq "") } {

 

set MyRedir [string map -nocase {%3a : %3f ? %3d = %26 &} $MyPath]

 

set ToCache 0

 

 

When i request this URL i get an error

 

http://mydomain/redirect.jsp;jsessionid=aea?path=http%3A//mydomain2/2010/bro/link.html%3Fud_046.html%23fsf

 

 

When i request this one with specific symbols, it works

 

http://mydomain/redirect.jsp;jsessionid=aea?path=http:%3A//mydomain2/2010/bro/link.html%3FFud_046.htmlfsf

 

 

How to set my irule to accept the "%23" symbols?

 

 

Thanks

 

  • in fact, with my irule BIG-IP doesn't manage to transform %23 to ,

     

     

    http://mydomain/html/redirect.jsp;jsessionid=dqd?path=http%3A//mydomain2/a/link.html%3Fud_046.html%23d

     

    > the result in my browser is:

     

    http://mydomain2/a/link.html?ud_046.html%23d

     

     

    instead of that:

     

    http://mydomain2/a/link.html?ud_046.htmld

     

     

    Any ideas on this issue?

     

    Thanks for your help

     

     

  • i solved the problem changind adding matching for %23

     

    set MyRedir [string map -nocase {%3a : %3f ? %3d = %26 & %23 } $MyPath]
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Another option to decode the URL encoded string would be to use the URI::decode command:

       set uri {http://mydomain/html/redirect.jsp;jsessionid=dqd?path=http%3A//mydomain2/a/link.html%3Fud_046.html%23d}
       log local0. "\$uri: $uri"
       log local0. "\[URI::query $uri\]: [URI::query $uri]"
       log local0. "\$uri decoded: [URI::decode [URI::query $uri]]"
    

    RULE_INIT>: $uri: http:// mydomain/html/redirect.jsp;jsessionid=dqd?path=http%3A//mydomain2/a/link.html%3Fud_046.html%23d

    RULE_INIT: [URI::query http:// mydomain/html/redirect.jsp;jsessionid=dqd?path=http%3A//mydomain2/a/link.html%3Fud_046.html%23d]: path=http%3A//mydomain2/a/link.html%3Fud_046.html%23d

    RULE_INIT: $uri decoded: path=http:// mydomain2/a/link.html?ud_046.htmld

    Aaron
  • Hi Aaron, thanks for your feebback,

    Indeed this irule has not been created by myself, and i was wondering on its meaning.

    So how do you advise to change it?

    like that: ?

      if { not([findstr $ParsedURI "redirect.jsp"] eq "") } {
                    set MyRedir [string map $MyPath]
                    set ToCache 0

    do you think the URLs will be correctly decode in every browsers ? because i believe that -nocase(....) have been specified for old browser issues but i'm not sure this is a good reason...

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    I am not sure what the goal of the iRule is so it's hard to give you a suggestion on what to change. Can you post the full iRule and any background info you might have for what it's supposed to do/issue(s) it's attempting to fix?

     

     

    Thanks, Aaron
  • i believe that -nocase(....) have been specified because of some decoding issues on old browser. do you think this could be possible?

     

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    I'm not aware of any browser issues with URL decoding. As I said, the browser should actually be URL encoding the parameter values. The web app should be decoding them before using the parameter values.

     

     

    Aaron