我已将我们的网站部署为 Cloud Run 服务。
根据此链接此处
中列出的文档添加了全局外部负载均衡器一切都很完美,我的网站现在运行为
https://example.com
我目前正在探索将
www.example.com
重定向到 https://example.com
.
尝试通过使用以下 yaml 配置编辑自定义域 http 来添加主机和路径规则
www.example.com
.
defaultService: projects/xyz/global/backendServices/custom-domains-example-com-example-49a4-be
name: matcher1
routeRules:
- urlRedirect:
stripQuery: true
hostRedirect: example.com
matchRules:
- prefixMatch: /
priority: 1
现在我可以将
www.example.com
重定向到 https://example.com
。但是,如果我访问 www.example.com/page1,
,它会将我重定向到 https://example.com
而不是 https://example.com/page1
。
你能帮助我如何实现这一目标吗?
另外,请告诉我这是否也是应遵循的最佳实践。
问候
斯里尼瓦桑