Forum Discussion

Jason_Keating's avatar
Jason_Keating
Icon for Altostratus rankAltostratus
Jun 01, 2017

HTTP::uri decodes encoded chars by default, and I don't see an option to stop it

I am doing simple HTTP to HTTPS redirects, I can't use a policy and need to use an iRule to do this.

 

My problem is some of the URI's contain encoded chars - in particular an encoded /. When I then use HTTP:uri to pass the URI to the redirect (in fact if I evaluate HTTP::uri in any way) the encoded chars have been decoded :( and in the case of the %2F which is the most common one this breaks things.

 

I did consider encoding the particular section of the URI that this char appears in but it's not predictable :(:(

 

I did ask the developer if they could stop encoding and translate to another legal char but it seems the framework they are using (Angular2) may be doing it rather than our code.

 

Anyone know how to either stop the chars being decoded or another way around this ?

 

Thanks Jason

 

3 Replies

  • Hi,

    I don't understand what is the issue.

    I tested your URI with the default

    _sys_https_redirect
    irule which redirect http to https and here is the result:

    $ curl http://company.local/0%2F101%2F0%2F1/621be240-355e-4f75-b96a-e4116d195fd4 -vv
    *   Trying 1.1.1.1...
    * Connected to company.local (1.1.1.1) port 80 (0)
    > GET /0%2F101%2F0%2F1/621be240-355e-4f75-b96a-e4116d195fd4 HTTP/1.1
    > Host: company.local
    > User-Agent: curl/7.43.0
    > Accept: */*
    > 
    * HTTP 1.0, assume close after body
    < HTTP/1.0 302 Found
    < Location: https://company.local/0%2F101%2F0%2F1/621be240-355e-4f75-b96a-e4116d195fd4
    < Server: BigIP
    * HTTP/1.0 connection set to keep alive!
    < Connection: Keep-Alive
    < Content-Length: 0
    < 
    * Connection 0 to host company.local left intact
    

    The redirect keep all encoded characters and did not decode them.