Play! framework: HTTPS and HTTP at the same time
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 开发者_Go百科to the HTTP port, my connection times out.
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://
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.
精彩评论