azure application gateway not able reroute traffic to multiple domain in APIM backend

Gaurav Kumar 20 Reputation points
2024-06-11T14:21:00.5966667+00:00

i have my organisation url api.domain1.com api.domain2.com

we have deployment azure application gateway with apim in internal vnet mode.

in APIM we have configured 2 custom domain

api.domain1.com

api.domain2.com

and now we want to configure application gateway 2 with 2 listener corresponding to both of the domain.

then add 2 routing rules to routes traffic for domain 1 and domain 2 to the APIM.

now APIM we want deploy common API where we want to apply a policy to check if the requests original host is domain1.com then route to to backendurl1 and if request original host is from domain2.com then route it to domain2.com.

in APIM the default SSL binding is selected with domain1.com so all API baseurl is set with domain1.com

but when we try with this setup the azure application gateway does not route the domain2.com traffic to APIM and throw error. whileas it correctly route traffic to domain1.com

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,912 questions
{count} votes

1 answer

Sort by: Most helpful
  1. UJTyagi-MSFT 230 Reputation points Microsoft Employee
    2024-06-12T07:54:05.4766667+00:00

    Hi @Gaurav Kumar
    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    Did you check if the policy in APIM which checks the original host of the request and routes it to the correct backend URL is working as expected. You can test this by sending requests directly to the APIM (bypassing the Application Gateway) and checking if they are routed correctly?

    If the default SSL binding in APIM is set to domain1.com, it might cause issues when routing traffic from domain2.com. You might need to configure APIM to use the correct SSL certificate based on the original domain hostname of the request.

    Kindly refer the below link which might be helpful in the configuration -

    https://video2.skills-academy.com/en-us/azure/api-management/api-management-howto-integrate-internal-vnet-appgateway

    0 comments No comments