Question

I started little project with Play Framework 2.0 and I wonder which is the better way for creating two-part site: admin and public? I want to make admin access over https protocol only.

Should I specify three sub-projects:

  • Domain model project
  • Public project
  • Admin project

But even in this case I wonder how to specify access to admin part over https only? Or this is possible to do in one project?

I've just found this: https://groups.google.com/group/play-framework/browse_thread/thread/d75cdb32d348dc0f/64838b04a452bfaf?lnk=raot which says that force HTTPS for some pages unavailable. Is there any workarounds?

Was it helpful?

Solution

To handle the HTTP or HTTPS access you can use a frontend HTTP server. I have used Nginx for that.

Then, with Nginx (or Lighthttpd) you can use this frontend server to handle HTTPS for some urls (for example: www.mydomain.com/secure/*) and HTTP for others.

For admin access, you can do both: two independent projets or a single one. The first solution seams harder to maintain and will raise some questions about shared cache or sessions.

For both solutions you will need to have a look at proxy forwarding as your HTTP/HTTPS requests will be handled by your frontend server and then forwarded to your Play app(s). Play documentation details how to configure Lighthttpd for this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top