如何使用 Azure API 管理 (APIM) 自定义域配置 Azure Front Door,而不将 CNAME 更改为 APIM?

问题描述 投票:0回答:1

我正在尝试为我的 Azure API 管理 (APIM) 网关配置自定义域,同时通过 Azure Front Door 路由流量。

这是我的设置:

自定义域: api.mydomain.de

Front Door:自定义域 api.mydomain.de 通过 CNAME 映射到 Azure Front Door (mydomain-gateway-d5dnaahpgpe9axh6.z01.azurefd.net),后者将流量路由到 APIM 网关 (apim-name.azure) -api.net)。

DNS: api.mydomain.de 存在指向 Front Door 的 CNAME 记录。

我的目标:

我希望在 APIM 中使用自定义域 api.mydomain.de 时保持流量流经 Azure Front Door。 当开发人员使用 APIM 开发者门户时,他们应该看到 api.mydomain.de 作为 API 网关 URL(不是默认的 APIM URL)。

问题:

当我尝试在 APIM 中添加 api.mydomain.de 作为自定义域时,它要求 CNAME 直接指向 apim-name.azure-api.net。但是,我希望 CNAME 指向 Azure Front Door (mydomain-gateway-d5dnaahpgpe9axh6.z01.azurefd.net),以便从 Front Door 功能(例如缓存和全局流量路由)中受益。

我尝试过的:

我已经在 Front Door 中设置了 DNS 和路由规则,它可以正确地将流量转发到 APIM。 如果不更改 CNAME,我无法继续将 api.mydomain.de 添加为 APIM 中的自定义域,但我不想绕过 Front Door。 问题:如何配置 APIM 以使用 api.mydomain.de 作为自定义域,同时仍通过 Azure Front Door 路由流量?有没有办法将自定义域添加到 APIM,而不将 CNAME 从 Front Door 更改为 APIM 网关?

azure azure-front-door apim
1个回答
0
投票

Azure 验证域并允许您将 api.mydomain.de 作为自定义域添加到 APIM 后,将 CNAME 恢复为指向 Front Door (mydomain-gateway-d5dnaahpgpe9axh6.z01.azurefd.net)。 ??

是的,您可以暂时使用上述方法来解决 Azure API 管理中的域验证要求。

  • 使用通配符 SSL 证书或跨多个子域工作的自定义 SSL 证书(如果尚未完成)。当您将此证书上传到 APIM 时,即使 CNAME 指向 Azure Front Door,自定义域也将起作用。

转到 Azure 门户并导航到 API 管理实例。在 API 管理服务中,转到设置部分下的自定义域

  • 单击 + 添加自定义域 并输入
    api.mydomain.de
  • 如果出现提示,请上传
  • api.mydomain.de 的 SSL 证书。确保您拥有自定义域的 SSL 证书,因为 APIM 需要此证书才能使自定义域正常工作。
    
    

enter image description here更新 Frontdoor 配置,导航到

Azure Front Door

实例。

    转到路由规则
  • 获取api.mydomain.de,并确保流量转发到 APIM 后端 (
    apim-name.azure-api.net
    )。
    
    
  • 在路由规则中,将
Backend Host Header

设置为apim-name.azure-api.net。这会检查 Azure Front Door 是否将流量正确转发到 APIM。

    

© www.soinside.com 2019 - 2024. All rights reserved.