Created
February 12, 2014 09:12
-
-
Save hanxue/8952231 to your computer and use it in GitHub Desktop.
Proxy implemented using Play Framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import play.api.mvc.{Action, Controller} | |
import play.api.libs.ws.WS | |
import play.api.libs.concurrent.Execution.Implicits._ | |
object Proxy extends Controller { | |
def index(url: String) = Action.async { | |
WS.url(url).get().map(resp => Ok(resp.body).as("text/html")) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Routes | |
# This file defines all application routes (Higher priority routes first) | |
# ~~~~ | |
# Home page | |
GET / controllers.Application.index | |
# Map static resources from the /public folder to the /assets URL path | |
GET /assets/*file controllers.Assets.at(path="/public", file) | |
GET /proxy controllers.Proxy.index(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Brilliant. I will copy this!