App Engine Flexible上的HTTP到HTTPS重定向 [英] HTTP to HTTPS redirection on App Engine Flexible
问题描述
我已经回答了这个问题:从http重定向到google cloud中的https ,但目前似乎不再准确.引用的锚点( https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml#security )似乎已删除,但没有替换说明.
I've followed the answer of this: Redirect from http to https in google cloud but it does not seem to be currently accurate any more. The anchor referenced ( https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml#security ) seems to have been removed but without a note of a replacement.
作为参考,我通过Google App(flex)引擎提供NodeJS.按照我在app.yaml
中得到的答案:
For reference, I am serving NodeJS over a Google App (flex) Engine. As per the answer I've got in my app.yaml
:
handlers:
- url: /.*
script: IGNORED
secure: always
由于HTTPS在到达我的Express引擎之前显然已经终止(因此重定向将毫无用处);当前如何正确实施?
Since HTTPS is obviously terminated before it hits my Express engine (and redirection on there would be useless); how is it currently correctly implemented?
可能有帮助,我通过控制台中的自定义域"选项卡连接了一个外部域,并且确实配置了SSL证书(因此,如果用户手动转到https://.com,一切都很好)
Potentially helpful, I have an external domain attached via the "Custom domains" tab in the console, and there is indeed a SSL certificate configured (so if a user manually goes to https://.com everything is fine)
推荐答案
弹性环境目前在app.yaml中不支持处理程序.如果要https://重定向,则有几种选择:
The flexible environment does not current support handlers in the app.yaml. If you want https:// redirection, you have a few options:
- Use helmet to do to HSTS stuff for you, and implement your own initial redirect.
- I wrote a happy little library to always forces SSL on all routes for express yes-https
我们正在考虑默认情况下将所有 all 流量自动重定向到SSL.您认为这对您的应用来说是件好事吗?
We are considering auto-redirecting all traffic to SSL by default. Do you think that would be a good thing for your apps?
这篇关于App Engine Flexible上的HTTP到HTTPS重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!