Books

Play experimental libraries are not ready for production use. APIs may change. Features may not work properly.

Play 2’s main server is built on top of Netty. In Play 2.4 we started experimenting with an experimental server based on Akka HTTP. Akka HTTP is an HTTP library built on top of Akka. It is written by the authors of Spray.

The purpose of this backend is:

to check that the Akka HTTP API provides all the features that Play needs

to gain knowledge about Akka HTTP in case we want to use it in Play in the future.

In future versions of Play we may implement a production quality Akka HTTP backend, but in Play 2.4 the Akka HTTP server is mostly a proof of concept. We do not recommend that you use it for anything other than learning about Play or Akka HTTP server code. In Play 2.4 you should always use the default Netty-based server for production code.

If for some reason you have both the Akka HTTP server and the Netty HTTP server on your classpath, you’ll need to manually select it. This can be done using the play.server.provider system property, for example, in dev mode:

run -Dplay.server.provider=play.core.server.akkahttp.AkkaHttpServerProvider

The Akka HTTP server is configured with Typesafe Config, like the rest of Play. This is the default configuration for the Akka HTTP backend. The log-dead-letters setting is set to off because the Akka HTTP server can send a lot of letters. If you want this on then you’ll need to enable it in your application.conf.

Note: In dev mode, when you use the run command, your application.conf settings will not be picked up by the server. This is because in dev mode the server starts before the application classpath is available. There are several other options you’ll need to use instead.