in app/com/gu/viewer/controllers/Proxy.scala [63:80]
def catchRelativePost(path: String) = AuthAction.async { implicit request =>
val fromProxy = """^\w+:\/\/([^/]+)\/proxy\/([^/]+).*$""".r
val host = request.host
request.headers.get("Referer") match {
case Some(fromProxy(`host`, service)) => {
val body = request.body.asFormUrlEncoded
ProxyRequest(service, path, request, body) match {
case r: PreviewProxyRequest => previewProxy.proxyPost(r)
case r: LiveProxyRequest => liveProxy.proxyPost(r)
case UnknownProxyRequest => Future.successful(BadRequest(s"Unknown proxy service: $service"))
}
}
case _ => Future.successful(NotFound(s"Resource not found: $path"))
}
}