How to make basepath case insensitive

I have a apigee proxy with basepath /cards/tokens. How, do I make this proxy case insensitive? so that
requests made to
1. myapigeehost/Cards/tokens
2 myapigeehost/cards/Tokens
or anyother combination like
myapigeehost/cArds/toKEns etc, get all served by the same proxy? 

0 3 146
3 REPLIES 3

The BasePath element does not support a regular expression for the path.

The BasePath DOES support wildcard elements for path segments. But there is no way to specify "case insensitive" matching whether you use wildcards or not. 

Within Apigee, there is no way to specify "case insensitive" matching on the BasePath for an API Proxy Endpoint.  

If you need this, I can think of two workarounds: 

  1. use  the Google Cloud Load Balancer to perform URL rewrites to get what  you want - basically normalize the incoming URL path to all lowercase, and then use a single Apigee API Proxy to handle that lowercase URL basepath.  (eg /cards/tokens) 
  2. Build an uber-proxy in Apigee that does the same thing. Basically you have your normal API proxy to use /cards/tokens as the basepath. Then you have another Apigee proxy to use / as basepath (empty basepath).  The 2nd proxy will receive ALL requests that do not exactly match /cards/tokens . Within the 2nd proxy you can "normalize" the URL path to convert it to all lowercase, and then invoke THAT API proxy. If I were doing this I would use a JS policy to do the normalization.  And you could also insert some validation at that layer too, if you like. For exmple, if the normalized path does not match a known path, then you could return a failure from there.  Alternatively you could just invoke the Apigee "target" and Apigee will return an error saying "no API listening at that basepath".  

But a better idea might be to just tell your App developers to respect the case of your URL paths. The Internet is case sensitive.  It seems odd in 2024 to want case-insensitive matches.