2
votes

I have a problem with a project deploy. Until now, I was using a single playframework app, running listening port 80. Now, I have published in the same server 2 apps, using Nginx as a proxy. Nginx listening in port 80 and the apps runs in port 9001 and 9002.

All works well, but the apps running in dev mode and not in prod mode, the page 404 does't work, and in html page I see the code error like this: "Action not found For request 'GET /asd'". I run the app with this command:

myapp -Dhttp.port=9001 -Dconfig.file=conf/application.conf -Dlogger.file=/mydir/conf/application-logger.xml -Dpidfile.path=/mydir/daasy.pid -server

I use playframework 2.4.3 with scala 2.11.7

Update: I have created a bootstrap class:

class onStartClass @Inject() (val app: Application)
{
  println(app.mode)
}

The app.mode return "Prod" when run in prod, with port 80 and also when run in port 9001.

But, when the app run in port 9001 doesn't work the page 404, the website return a playframework error page.

1
how do you package/deploy your app ? - Jean
@Jean with dist, then I put the zip in the server, unzip and start. - faster2b
You could use curl to check if your two apps work without your proxy. Just specify the port 9001 or 9002, e.g. curl http://youraddress.com:9001/asd. - Kris
@Kris, yes I can, is a test then I made. The apps works, but works in Dev mode, I can access with the port 9001 and 9002. - faster2b
@faster2b Sorry, I have trouble understanding. You say, your 2 apps work well in dev mode but not in prod mode? - Kris

1 Answers

0
votes

As I understand it, what you observe is the correct behavior of Play 2.4

In dev mode, 404 are handled by the devNotFound.scala.html template and yield errors which look like : enter image description here

In prod mode, 404 are handled by the notFound.scala.html template and yield errors which look like: enter image description here

Notice how the first error lists all the existing routes, while the second doesn't.

If you want another rendering for 404 NotFound errors you will need to create your own error handler as documented in ScalaErrorHandling