不安全的 HttpServletRequest getURI google 云

Not secure HttpServletRequest getURI google cloud

我们正在使用 Auth0 集成为我们的 spring 启动应用程序提供身份验证。 google 云 运行.

中部署了一个应用程序 docker

但是当我尝试交换令牌时,我收到来自 auth0 的错误消息“应为 https://.. 但转到 http://。” 发生这种情况的原因是 httpServletReuqest.getRequestURI() returns http 而不是 https。

问题是当我们的网站在云中部署为 https 运行 时,为什么 getRequestURI returns http? 我还登录了 nginx headers 和 X-Forwarded-Proto = https.

发布为社区 Wiki,因为它基于@EmilGi 和@GuillaumeBlaquiere 的评论。

如你所见documentation:

Cloud Run redirects all HTTP requests to HTTPS but terminates TLS before they reach your web service. If your service generates a web resources that refers to other web resources with unsecured URLs (http://), your page may be subject to mixed content warnings or errors.

并且您无法关闭此限制,因为云 运行 部署在负责 TLS 通信的 GFE(Google 前端)后面。