玩!框架:同时使用HTTPS和HTTP
我将 https.port
添加到我的 application.conf
中以获得 HTTPS 支持。问题是我的路由之一需要通过 HTTP 访问,因为客户端不支持 HTTPS。是否有可能在不必禁用整个站点的 HTTPS 的情况下实现这一点?
谢谢。
编辑:
我的路由文件非常标准,自从我转换为 HTTPS 以来就没有改变。问题是当我想连接到 HTTP 端口时,连接超时。
I added https.port
to my application.conf
to gain HTTPS support. The problem is one of my routes require to be accessible through HTTP because the client is not supporting HTTPS. Is it somehow possible to make this happen without having to disable HTTPS for the whole site.
Thanks.
Edit:
My route file is pretty standard and has not changed since I converted to HTTPS. The problem is when I want to connect to the HTTP port, my connection times out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需要在 application.conf 文件中同时包含 http.port 和 https.port 即可。对于您想要与普通站点不同的链接,请使用 @@ 符号:
@@{Controller.action().secure()} => https://...
@@{Controller.action()} => http://
You just need to have both http.port and https.port in the application.conf file. For the links you want to be different from the normal site, use the @@ notation:
@@{Controller.action().secure()} => https://...
@@{Controller.action()} => http://
我用的是2.0
在我的例子中
@routes.Application.authenticate().absoluteURL(secure = true)
生成 https 前缀 URL,认为它不起作用,因为我还没有完全配置它。在产品中,我无论如何都计划使用反向代理。
I'm using 2.0.
In my case
@routes.Application.authenticate().absoluteURL(secure = true)
generates https prefixed url, thought it's not working since I didn't fully configure it yet.In prod I'm planning to use reverse proxy anyways.