1

In Azure API Management (APIM), I want to setup wildcards for all GET and POST operations to my backend service. I'm encountering an issue where the consumer has to specify a trailing slash in order for the request to complete.

The wildcard is specified in APIM like this:

Wildcard specified in APIM

Example, these all work:

{{endpoint}}/devices/      <-- notice trailing slash here)
{{endpoint}}/devices/12345 
{{endpoint}}/devices/12345/foo

It's just the base endpoint of a resource that does not work without the trailing slash, like:

{{endpoint}}/devices

In my particular case, it doesn't seem to recognise the route without the explicit trailing slash and requires the user to authenticate.

Is there a way to accept both with/without trailing slashes?

Juliën
  • 9,047
  • 7
  • 49
  • 80
  • Are these helpful? [WildCard option in azure apim for POST and GET REST API](https://learn.microsoft.com/en-us/answers/questions/631841/wildcard-option-in-azure-apim-for-post-and-get-res.html) and [Azure APIM "rewrite-uri" policy - How to remove the URL suffix?](https://stackoverflow.com/questions/54314693/azure-apim-rewrite-uri-policy-how-to-remove-the-url-suffix) – Ecstasy Aug 10 '22 at 08:24

1 Answers1

0

solved it as follow :

  1. set up a GET /{*path} wildcard operation for current api
  2. add the following policy to the operation inbound processing: <rewrite-uri template="{path}" copy-unmatched-params="true" />

screenshots in github post

sebps
  • 1
  • 1