在 App Engine 柔性环境自定义运行时上强制使用 SSL [英] Force SSL on App Engine Flexible Environment Custom Runtime

查看:26
本文介绍了在 App Engine 柔性环境自定义运行时上强制使用 SSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用基于 openjdk:8 的 Dockerfile 在 App Engine 灵活自定义运行时上运行 Metabase 实例.目前它允许访问 http://[metabase-project].appspot.com/https://[metabase-project].appspot.com/.我想通过将所有 http 流量重定向到 https 来强制使用 SSL.

We're running an instance of Metabase on a App Engine Flexible Custom Runtime with a Dockerfile based on openjdk:8. Currently it allows access on http://[metabase-project].appspot.com/ and https://[metabase-project].appspot.com/. I'd like to force SSL by having all http traffic redirected to https.

Dockerfile 看起来像这样:

The Dockerfile looks something like this:

FROM openjdk:8
ADD https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 ./cloud_sql_proxy
ADD http://downloads.metabase.com/v0.21.1/metabase.jar ./metabase.jar
CMD ./cloud_sql_proxy -instances=$INSTANCE=tcp:$MB_DB_PORT -dir=/cloudsql & java -jar ./metabase.jar

我们的 app.yaml 看起来像:

Our app.yaml looks like:

service: metabase
runtime: custom
env: flex

在普通的 App Engine app.yaml 文件中,我想添加:

In a normal App Engine app.yaml file, I'd want to add:

handlers:
- url: [something]
  secure: always

但是在自定义运行时我们无法访问这样的处理程序.有没有办法配置灵活的运行时为所有流量执行重定向?

But in the custom runtime we don't have access to handlers like this. Is there a way to configure the Flexible runtime to perform the redirect for all traffic?

推荐答案

App Engine Flex 根本不支持处理程序:https://cloud.google.com/appengine/docs/flexible/java/upgrading#appyaml_changes

App Engine Flex doesn't support handlers, at all: https://cloud.google.com/appengine/docs/flexible/java/upgrading#appyaml_changes

如果您需要 https://重定向,则需要在您的应用程序中进行.对不起!

If you need https:// redirects, you need to do it from within your application. Sorry!

这篇关于在 App Engine 柔性环境自定义运行时上强制使用 SSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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