diff --git a/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/ReactiveLoadBalancerClientFilter.java b/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/ReactiveLoadBalancerClientFilter.java index 3de2276981..fff510421a 100644 --- a/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/ReactiveLoadBalancerClientFilter.java +++ b/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/ReactiveLoadBalancerClientFilter.java @@ -114,7 +114,7 @@ public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { .getSupportedLifecycleProcessors(clientFactory.getInstances(serviceId, LoadBalancerLifecycle.class), RequestDataContext.class, ResponseData.class, ServiceInstance.class); DefaultRequest lbRequest = new DefaultRequest<>( - new RequestDataContext(new RequestData(exchange.getRequest()), getHint(serviceId))); + new RequestDataContext(new RequestData(exchange.getRequest(), exchange.getAttributes()), getHint(serviceId))); return choose(lbRequest, serviceId, supportedLifecycleProcessors).doOnNext(response -> { if (!response.hasServer()) { @@ -154,7 +154,7 @@ public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { .onComplete(new CompletionContext( CompletionContext.Status.SUCCESS, lbRequest, exchange.getAttribute(GATEWAY_LOADBALANCER_RESPONSE_ATTR), - new ResponseData(exchange.getResponse(), new RequestData(exchange.getRequest())))))); + new ResponseData(exchange.getResponse(), new RequestData(exchange.getRequest(), exchange.getAttributes())))))); } protected URI reconstructURI(ServiceInstance serviceInstance, URI original) {