play-framework [2.0] HTTPS

2019-04-28 11:43发布

i'me working on a web server using play framework 2.0, where the login is executed by a android device software we're also making. And are main concern is that we can't find any support for HTTPS in play 2.0. Sense this is a school project we can't aford clouds nor other proxy to solve the HTTPS for us.

Our main problem is the password and email going in plain sight in the request's body, encrypting and decrypting in the mobile device and on the server looks costly in performance and sense HTTPS takes care of this we wanted to avoid it. Is there any way we can use HTTPS to protect the users login data, or any other suggestion.

If not we might have to migrate all are application to another framework, because it wont look good important confidential data going through the internet without encryption.

2条回答
三岁会撩人
2楼-- · 2019-04-28 12:20

Historically, I've seen most folks run the Java/Scala application server behind a reverse proxy of some kind. Setting up HTTPS in apache isn't too hard, and then just use ModProxy to send requests internally to your Play application.

Any one of the reverse proxy systems can likely do this, nginx is popular too, and generally has easier configuration than apache, but I've never used it with HTTPS.

The number one reason normally to do this is security. You can't start a Java program as a non privileged user on port 80. If you start your Java program as root running on port 80, then any hole in your application has root privileges! As a result, starting the Java app on another port, then reverse proxy from an web server that can run as a non-priveleged user on port 80.

(*) This is a slightly over-simplified, but a discussion of this weirdness is beyond the scope of this I think.

查看更多
看我几分像从前
3楼-- · 2019-04-28 12:37

It's now possible to use Play and https directly. This was added in Play 2.1

Simply start the server with:

JAVA_OPTS=-Dhttps.port=9001 play start
查看更多
登录 后发表回答