In vertx, Is there a way I can just change header and redirect to another server

Viewed 499

I am new to Vertx, I am writing a proxy server, which will take request, update header, and send to another server. On receiving response, send the complete response as it is to client.

In vertx, Is there a way I do this straign forward or I need to implement handler for each http method and content type, to create new request and send using new client?

1 Answers

If you are using vertx-web of version 3.x and below, then you can do:

void redirect( RoutingContext rc, String url ) {
  if( !rc.response().ended() ) 
    rc.response().setStatusCode( 303 ).putHeader( 'Location', url ).end()
}
Related