serve static play2.x content from CDN

Posted by Adam Lane on Stack Overflow See other posts from Stack Overflow or by Adam Lane
Published on 2012-07-04T20:52:54Z Indexed on 2012/07/04 21:15 UTC
Read the original article Hit count: 127

Filed under:
|
|

In development mode I would like to have assets served locally and when deployed in production I would like them served from the CDN. Anyone using play2 and serving content from CDN be willing to share how they are doing it?

// Thinking of something like this in the routes file...
@if(play.Play.isDev()) {
    GET     /assets/*file               controllers.Assets.at(path="/public", file)
} else {
    GET     CDNPATH/assets/*file        controllers.Assets.at(path="CDNPATH", file)
}

(Note: using 2.0.2 because of the headers fix https://github.com/playframework/Play20/pull/276)

© Stack Overflow or respective owner

Related posts about routes

Related posts about playframework-2.0