Ale*_*lex 3 http-status-code-301 google-cloud-dns
Namecheap 和其他注册商提供了一种在配置 DNS 时设置 HTTP 301 或 302 重定向的方法。这是一个很好的功能,否则您需要自己实现它。请参阅以下 Namecheap DNS 配置页面的屏幕截图。
谷歌云 DNS 是否提供类似的东西?
Google Cloud DNS 不提供“URL 重定向”。这实际上不是 DNS 功能 - 它需要一个网络服务器来服务 302 重定向。你可以用一个小的云函数来实现这个,比如:
exports.redirectFunc = function redirectFunc (req, res) {
res.set('Location', 'https://example.com/destination');
res.status(302);
res.end();
};
Run Code Online (Sandbox Code Playgroud)
虽然 Google Cloud DNS 没有此功能,但如果您使用Google Domains注册您的域名,它具有“子域名转发”功能(https://support.google.com/domains/answer/6072198,它不仅实现了 301 / 302重定向,还为 G Suite 和其他平台提供集成,以设置其他类型的综合记录 ( https://support.google.com/domains/answer/6069273 )。
Google Domains 与 Google Cloud DNS 运行在相同的 DNS 服务基础设施上,但目前您必须在“Google Domains 域名服务器”和 Google Cloud DNS 域名服务器之间进行选择,后者为您可以使用 Google Cloud DNS API 以编程方式控制的托管区域提供服务。这意味着您必须在特定于域的功能(例如综合记录)以及 Cloud DNS API 和 GUI 控制台之间进行选择。您可以将 Google Domains 域名服务器上托管的域名的子域名委托给 Cloud DNS 中的特定托管区域,因此可以对此进行混合和匹配。
| 归档时间: |
|
| 查看次数: |
6949 次 |
| 最近记录: |