[英]How to map a GCP Loadbalancer IP to a custom domain using A Records?
[英]Reusing custom domain between GCP and Firebase
我计划使用 Firebase 托管 2 个 Web 应用程序: example.com
和dev.example.com
。 对于相应的 API,我在 GCP 上有 2 个项目(使用托管实例组和负载均衡器),带有自定义域: api.example.com
和dev-api.example.com
是否可以设置我的自定义域example.com
可以在 Firebase 和 GCP 中重复使用? 我希望这是一个流行的设置,但找不到任何文档/操作方法。 如果有帮助,我将使用 Google Domains 作为域提供商,例如example.com
并使用 Google 管理的 SSL 证书。
确保删除指向其他提供商的任何 A 记录或 CNAME 记录。 同时删除任何 AAAA 记录。 如果存在任何这些记录类型,则 Firebase 无法提供 SSL 证书。
A 记录和 CNAME 记录使用什么值? 使用来自 Cloud DNS 的负载均衡器 IP example.com
A 记录来说似乎是个坏主意,因为根示例。 另外,为什么 Firebase 强制添加 TXT 记录而 Cloud DNS 没有?
Assuming that you are using a Classic HTTPS Load Balancer with your GCP project, you may get your Firebase Hosting linked to your LB as an additional backend through Internet Network Endpoint Group so all of them can be reached through the same Load Balancer IP.
去做这个,
Backend configuration
Backend type
下,select Internet Network Endpoint Group
Create Internet Network Endpoint Group
。 这会将您带到 Compute Engine 下的网络端点组New network endpoint
> Add through
下,您可以 select IP and port
或Fully qualified domin name and port
。 只需提供您的 Firebase 主机的正确 FQDN 或 IP 以及 Firebase 主机正在侦听的端口,然后创建。Host and Path rules
下。 点击+Add Host and Path Rule
,请在Host
字段中填写您的 Firebase 主机的域。 对于Path
,只需输入/*
。 然后 select 您创建为后端的 Internet 网络端点组。我还假设您的 Google 托管证书也部署在负载均衡器中。 如果是这种情况,那么您可以提供另一个 Google 托管 SSL 证书并包括所有 4 个域
example.com
dev.example.com
api.example.com
dev-api.example.com
完成后,您可以使用负载均衡器的 IP 地址为每个域创建 A 记录。 这是为了确保将请求转发到正确的后端,而不是只创建 CNAME,它将始终将请求转发到根域 (example.com) 而不是其预期的后端。 LB 应该能够根据被访问的域转发请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.