How to stream 301 redirect from ws client in play framework

301 Views Asked by At

I am a writing a middleware program, where it internally calls third party api. The third party api responds with 301 including some headers. I have respond with response i got to front end. Is there any piece of code sample which will do this?

1

There are 1 best solutions below

2
On

In this case, I do not see other options rather than building the response object setting the headers.

public Result proxy() {
  response().setHeader(myHeader, headerValue1);
  // all your custom headers
  return status(Http.Status.MOVED_PERMANENTLY, "response body").as(your media type);
}