强制使用Azure自定义域 [英] Force use of Azure custom domain

查看:74
本文介绍了强制使用Azure自定义域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以阻止通过Azure提供的域访问我的Azure网站,并通过Azure中的设置/配置强制使用自定义域?

Is it possible to prevent access to my Azure website from the Azure provided domain and force the use of the custom domain via a setting/configuration within Azure?

现在我有一个与我的Azure Web App关联的自定义域.

Right now I have a custom domain associated with my Azure Web App.

因此,在域名下,列出了2个,我的自定义域和azure提供的域.

So, under domain names, there are 2 listed, my custom domain and the azure provided domain.

示例: mywebapp.com mywebapp.azurewebsites.net

Example: mywebapp.com mywebapp.azurewebsites.net

我希望仅允许通过自定义域进行访问.因此,不应允许mywebapp.azurewebsites.net或将其重定向到mywebapp.com.

I want traffic to only be allowed in via the custom domain. So, mywebapp.azurewebsites.net should either not be allowed or should redirect to mywebapp.com.

推荐答案

最简单的方法是更改​​web.config并添加URL重写规则,该规则将从* .azurewebsites.net域永久重定向到您的域

The easiest way is to change your web.config and add a URL Rewrite rule that will do a permanent redirect from the *.azurewebsites.net domain to your domain.

您可以找到有关他们如何将domain.com做到www.domain.com的示例,并且可以应用相同的逻辑.该文章说明了该操作.

You can find an example on how they do that for domain.com to www.domain.com and you can apply the same logic. This article explains how to do that.

这篇关于强制使用Azure自定义域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆