spring-cloud / spring-cloud/spring-cloud-gateway

Httptrace endpoint does not show actual headers sent by Gateway

Open
#996 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.