Search in sources :

Example 1 with RoutingContext

use of com.linecorp.armeria.server.RoutingContext in project curiostack by curioswitch.

the class RoutingService method serve.

@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) {
    RoutingContext mappingContext = ctx.routingContext();
    final WebClient client;
    if (pathClients != null && mappingContext.query() == null) {
        client = pathClients.get(mappingContext);
    } else {
        client = find(mappingContext);
    }
    if (client == null) {
        return HttpResponse.of(HttpStatus.NOT_FOUND);
    }
    // We don't want to pass the external domain name through to the backend server since this
    // causes problems with the TLS handshake between this server and the backend (the external
    // hostname does not match the names we use in our certs for server to server communication).
    req = req.withHeaders(req.headers().toBuilder().authority("").build());
    return client.execute(req);
}
Also used : RoutingContext(com.linecorp.armeria.server.RoutingContext) WebClient(com.linecorp.armeria.client.WebClient)

Aggregations

WebClient (com.linecorp.armeria.client.WebClient)1 RoutingContext (com.linecorp.armeria.server.RoutingContext)1