Service Virtualization

Expand all | Collapse all

How to handle HTTP URI with incorrect case and route to VS

  • 1.  How to handle HTTP URI with incorrect case and route to VS

    Posted Jan 03, 2018 05:24 PM

    Hello, 

    I have created a Virtual Service (REST based) for an application. Some of the consumers of this Application use lower case URI (eg.  /application/service/v1 )of the REST service as opposed to Upper case URI (eg. /Application/Service/v1) . When they hit the Virtual Service , it fails because the Service URI does not match the Virtual Service URI.

     

    Is there a way to ignore HTTP URI case in the Virtual Service ? Irrespective of the URI /Resource path case , the VS has to respond. Please let me know . Thanks



  • 2.  Re: How to handle HTTP URI with incorrect case and route to VS
    Best Answer

    Posted Jan 03, 2018 05:47 PM

    The short answer is 'no'.

     

    URI validation is performed by the webserver based on the base path registered when the VSM is deployed.

    I have never figured out how to disable case sensitivity in the built-in DevTest webserver. Perhaps, someone else has figured this out and can provide instructions.

     

    Alternative Approach:

    Since the port and base path (specified in the VSM's listen step) are registered with the webserver when the service is deployed, you might consider creating two config files (one with BASE_PATH=/application/service/v1 and one with BASE_PATH=/Application/Service/v1). In the VSM's Listen step use {{BASE_PATH}} notation as the base path. Then, deploy the services (one with config 1, and one with config 2) to the same port. Since case sensitivity applies, the request should route to the correct VSM. Both VSMs are identical with the exception of the base path used during deployment.

     

    Side note:

    I do not recommend deploying the service with a Base Path of "/" since this could allow requests your service is unable to process. Deploying with "/" only can potentially create issues for the VSE service when some security scanning products send malformed requests and injections to the port.

     

    Thanks to a note from Prem_Bairoliya on an earlier post, I found the following. It seems there are some queuing techniques in play as well -- which is probably associated with the internal threading model:

    https://docops.ca.com/devtest-solutions/9-1/en/using/using-ca-service-virtualization/using-the-workstation-and-console-with-ca-service-virtualization/editing-a-vsm/virtual-http-s-listener-step 

    • Base path
      Identify the HTTP requested resource URIs that the listen step is to process. When the request comes in, the list of queue names is scanned for a name (base path) that starts the URI on the request. The queue name that matches is the one into which the request is placed. The listen step that is associated with the queue (by base path) processes the request.


  • 3.  Re: How to handle HTTP URI with incorrect case and route to VS

    Posted Jan 03, 2018 06:58 PM

     Great thanks Joel. this helps .