我有一个在 Sbt 上运行的 Play Framework 2.3.6 版本应用程序,使用 Sbt SSL 端点和 scala 编码......
我希望在 header 中看到 (hsts)strict 传输安全响应。
我正在 postman 本地尝试使用 URL http://localhost:9000
代码怎么写?
最好的方法是什么?对于 play 2.3
我在 play 博客中搜索并了解到 2.6 及更高版本支持重定向过滤器,但我只使用 2.3.x 版本。
是否提供了任何最佳解决方案来使用 HTTP 在 postman 中进行本地测试。这样我就可以在响应中看到 hsts header 。
注意:我在生产模式下阻止了 HTTP。我只能在生产中使用 https。
最佳答案
将此行添加到您的 application.conf 中:
play.filters.https.strictTransportSecurity="max-age=31536000; includeSubDomains"
您可以使用 curl 请求来检查:
curl -s -D- https://localhost:9000/{{api}} | grep -i Strict
引用:https://www.namecheap.com/support/knowledgebase/article.aspx/9711/38/how-to-check-if-hsts-is-enabled
关于scala - 如何使用 scala 代码在 Play framework 2.3.x 中启用 HSTS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49532449/