Layer7 API Management

Expand all | Collapse all

URI With Pipe is Invalid?

Jump to Best Answer
  • 1.  URI With Pipe is Invalid?

    Posted 08-22-2016 03:37 PM

    Hello,

     

    I need to route to a URI that happens to have a pipe in the querystring.  The gateway doesn't seem to like this.  Are there any workarounds?

     

    http://<server>/context/service?filter=foo|bar

     

    The logs show:

     

    "Error msg: Invalid URI"

     

    Removing the pipe fixes the problem, but I need this as part of the querystring.

     

    Thanks!


    Alejandro



  • 2.  Re: URI With Pipe is Invalid?

    Posted 08-22-2016 05:02 PM

    Hi Alejandro,

     

    What version of Gateway are you using? I was unable to reproduce this behavior on my 9.0 virtual appliance.

     

    i.e:

    https://ssg90:8443/service?filter=foo|bar

    I can see the parameter being processed successfully via

     

    ${request.http.parameter.filter}  //returns foo|bar

     

    If you can provide your version and form factor I can continue to test this.

     

    Regards,

    Joe



  • 3.  Re: URI With Pipe is Invalid?

    Posted 08-23-2016 12:05 PM

    I am running 8.4 as a VM.

     

    Thanks,

     

    Alejandro



  • 4.  Re: URI With Pipe is Invalid?

    Posted 08-24-2016 09:08 AM

    I have been unable to reproduce this behavior in 7.x, 8.x or 9.x.

    As you can see below the service is reachable and displays the pipe separated query parameter.

     

    I would recommend opening a case with support so we can investigate this further for you.



  • 5.  Re: URI With Pipe is Invalid?

    Posted 08-24-2016 10:51 AM

    Thanks for checking... I actually dug a little deeper.  The problem is when the offending querystring is used to form the route URI.

     

    In my routing assertion, I form the URI as follows:

     

    http://example.backend.com${param.uri}${request.url.query}

     

    The problem shows up when I add in the ${request.url.query} bit.

     

    Here is my example policy.  Is there a better way to formulate the route?

     

    Thanks,

     

    Alejandro



  • 6.  Re: URI With Pipe is Invalid?
    Best Answer

    Posted 08-24-2016 11:55 AM

    @acalbazana

    Thank you for clarifying. This is now reproducible in my environment.

    I have also picked up the new case you opened so we can work through this.

     

    RFC1738 designates the pipe as an unsafe (though supported) character in a URL.

    It looks like we can probably work around this by URL encoding the query parameters.  I will do some testing today and reach out so we can work on it further.

     

    Regards,

    Joe



  • 7.  Re: URI With Pipe is Invalid?

    Posted 08-25-2016 07:09 PM

    Hi Alejandro,

    The problem should be due to your URL is not URL encoded. The Encode/Decode data assertion should be the solution for your problem.

    BTW: Joe cannot reproduce the problem on soapUI is because, I believe, soapUI will conduct the URL encode automatically.

     

    Regards,

    Mark