spring-cloud / spring-cloud/spring-cloud-gateway
Httptrace endpoint does not show actual headers sent by Gateway
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
In Zuul in /httptrace endpoint we see in request.headers all headers that were sent to the backend service from client including headers that were added by Zuul.
In Gateway instead we see only headers that Gateway received from client and headers that are added by Gateway are not included into /httptrace endpoint.
HttpTraceWebFilter traces only the request with original headers. See:
private Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain,
Principal principal, WebSession session) {
ServerWebExchangeTraceableRequest request = new ServerWebExchangeTraceableRequest(
exchange);
final HttpTrace trace = this.tracer.receivedRequest(request);
exchange.getResponse().beforeCommit(() -> {
TraceableServerHttpResponse response = new TraceableServerHttpResponse(
exchange.getResponse());
this.tracer.sendingResponse(trace, response, () -> principal,
() -> getStartedSessionId(session));
this.repository.add(trace);
return Mono.empty();
});
return chain.filter(exchange);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with HttpTraceWebFilter and its filter method, then trace how the Gateway request is sent to the backend. Compare the request recorded for /httptrace with the headers added by Gateway, and verify that the endpoint reports the headers actually sent downstream.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100