gpt4 book ai didi

google-app-engine - https 仅在谷歌应用引擎中

转载 作者:太空宇宙 更新时间:2023-11-03 15:17:32 24 4
gpt4 key购买 nike

我现在在谷歌应用引擎项目上。在我的应用程序中,我必须只允许 https 协议(protocol)。而且我必须限制其他协议(protocol)。它应该只允许 https。我在 web.xml 中添加了以下代码。

<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

但在部署后它适用于两种协议(protocol)(http 和 https)。如何限制http?

最佳答案

可以在 WEB-INF 文件夹的 app.yaml 文件中将各个处理程序配置为需要 HTTPS,如下所述:Java Application Configuration Using app.yaml - Google App Engine .

您只需将这两个词添加到您的 app.yaml 文件中适当的 url 条目下:
安全:始终

例如:

- url: .*
script: main.app
secure: always

然后,如果用户尝试使用 HTTP 访问 URL,她将被自动重定向到 HTTPS。很酷。

关于google-app-engine - https 仅在谷歌应用引擎中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5367974/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com