@Karl Gardner Thanks for reaching out. The rewrite-uri
policy in APIM is more specific than the general routing that APIM performs.
When you set up an API in APIM, you define a public endpoint that clients use to access your API. APIM then routes these requests to the appropriate backend service based on the configuration you provide.
The rewrite-uri
policy allows you to modify the request URL before it is sent to the backend service. This can be useful in several scenarios, such as path adjustments, versioning.
For example, if your public API endpoint is https://api.example.com/v1/products
but your backend service expects https://backend.example.com/api/products
, you can use the rewrite-uri
policy to adjust the URL accordingly.
Here’s a simple example of how you might configure this policy:
<inbound>
<base />
<rewrite-uri template="/api/products" />
</inbound>
This policy ensures that when a request comes to https://api.example.com/v1/products
, it is rewritten to https://backend.example.com/api/products
before being sent to the backend.
hope this helps! do let me know incase of further queries, I would be happy to assist you.