Forum Discussion

Tushar Kumar's avatar
Tushar Kumar
Brass Contributor
Jan 12, 2023

URL Based Routing when wildcard in the middle of the URL

I am trying to do URL based routing for my APIs but I am not able to achieve as my API endpoints contain a wildcard in the middle of the URL, like:

  • /prodapi/v1.0/{appId}/level
  • /prodapi/v1.0/{appId}/products

appId is my customers white label ID, so it's unique for all our customers.

So far I have tried :

  • Azure application gateway [ But you can only handle at the end of your URL]
  • Azure Fron door [Have the same settings]
  • API management [ Not allowing me to do wildcard]

Can someone help me with any azure native or Out of the box solution.

1 Reply

  • There are several Azure services that can be used to achieve URL-based routing with a wildcard in the middle of the URL. Here are some possible solutions:

    Azure Traffic Manager: Azure Traffic Manager is a DNS-based traffic load balancer that can be used to route incoming requests to different endpoints based on routing rules. With Traffic Manager, you can create a routing rule based on the {appId} wildcard in the middle of the URL. Traffic Manager can route traffic to any endpoint that is capable of responding to DNS queries.

    Azure API Management: Azure API Management is a fully managed service that enables you to create, publish, and manage APIs. With API Management, you can create a URL-based routing rule that includes the {appId} wildcard. You can use policies in API Management to transform the URL before it is passed to the backend API.

    Azure Kubernetes Service (AKS): If you are using a containerized approach for your APIs, you can deploy them to AKS and use Kubernetes Ingress to handle URL-based routing. With Ingress, you can define routing rules based on the {appId} wildcard and route traffic to different services based on those rules.

    Azure Functions: Azure Functions is a serverless compute service that allows you to run code in response to events or triggers. With Functions, you can create a HTTP-triggered function that handles requests for your API. You can use the {appId} wildcard in the URL and use code in your function to route traffic to the appropriate backend service.

    Azure Logic Apps: Azure Logic Apps is a cloud-based service that allows you to create workflows and integrations with other services. With Logic Apps, you can create a workflow that handles requests for your API. You can use the {appId} wildcard in the URL and use code in your workflow to route traffic to the appropriate backend service.

    These are just a few examples of Azure services that can be used to achieve URL-based routing with a wildcard in the middle of the URL. The best solution for your specific use case will depend on your specific requirements and constraints.

    here are more details and reference links for each of the solutions I suggested:

    Azure Traffic Manager: Azure Traffic Manager is a DNS-based traffic load balancer that can be used to route incoming requests to different endpoints based on routing rules. With Traffic Manager, you can create a routing rule based on the {appId} wildcard in the middle of the URL. Traffic Manager can route traffic to any endpoint that is capable of responding to DNS queries. To set up Traffic Manager, you can follow the instructions in the Azure documentation:
    https://learn.microsoft.com/en-us/azure/traffic-manager/traffic-manager-overview
    Azure API Management: Azure API Management is a fully managed service that enables you to create, publish, and manage APIs. With API Management, you can create a URL-based routing rule that includes the {appId} wildcard. You can use policies in API Management to transform the URL before it is passed to the backend API. To set up API Management, you can follow the instructions in the Azure documentation:
    https://learn.microsoft.com/en-us/azure/api-management/
    Azure Kubernetes Service (AKS): Azure Kubernetes Service (AKS) is a fully managed service that makes it easy to deploy and manage containerized applications. With AKS, you can deploy your APIs to Kubernetes and use Kubernetes Ingress to handle URL-based routing. With Ingress, you can define routing rules based on the {appId} wildcard and route traffic to different services based on those rules. To set up AKS and Ingress, you can follow the instructions in the Azure documentation:
    https://kubernetes.io/docs/concepts/services-networking/ingress/

    Azure Logic Apps: Azure Logic Apps is a cloud-based service that allows you to create workflows and integrations with other services. With Logic Apps, you can create a workflow that handles requests for your API. You can use the {appId} wildcard in the URL and use code in your workflow to route traffic to the appropriate backend service. To set up Azure Logic Apps, you can follow the instructions in the Azure documentation:

    https://learn.microsoft.com/en-us/azure/logic-apps/


Resources