Play framework 404 error with assets on stage mode

2019-07-20 06:16发布

问题:

I've got a problem running my Play framework app on stage mode.

If I run the app on dev mode, with play run for instance, everything is ok. If I compile the app with play compile clean stage, and then use start, all my assets are unreachable (I get a 404 error).

I'm aware of the bug/feature about empty files, but that's actually not the case here.

My route is the same as the doc:

GET     /assets/*file               controllers.Assets.at(path="/public", file)

Can anybody help me ? Thanks !

回答1:

Actually sounds like Play Framework is able to get files with // in the path in dev mode, but not in stage.

So this should works on dev mode:

assets//images/image.png

But not in stage mode. To correct this, just replace // with /