Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loss of context path after using ServerRequest.from #28820

Closed
danielrehmann opened this issue Jul 14, 2022 · 0 comments
Closed

Loss of context path after using ServerRequest.from #28820

danielrehmann opened this issue Jul 14, 2022 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@danielrehmann
Copy link

Recently I found a strange behaviour after adding a Filter to our project that uses ServerRequest.from. After I added the filter the contextPath was gone and the pathWithinApplication contained the full path.

As we are using a reverse Proxy and want to return correct location headers we are dependent on the contextPath set by the ForwardedHeaderTransformer.

My question is if this is intended behaviour or is this a bug in the framework.

I think I found the culprit of this behaviour here:

public BuiltServerHttpRequest(String id, HttpMethod method, URI uri, HttpHeaders headers,
				MultiValueMap<String, HttpCookie> cookies, Flux<DataBuffer> body) {
			this.id = id;
			this.method = method;
			this.uri = uri;
			this.path = RequestPath.parse(uri, null);
			this.headers = HttpHeaders.readOnlyHttpHeaders(headers);
			this.cookies = unmodifiableCopy(cookies);
			this.queryParams = parseQueryParams(uri);
			this.body = body;
		}

in the this.path = RequestPath.parse(uri, null); where the context path is explicitly set to null.

The issue looks similar to #25279 where the behaviour was fixed for mutating ServerHttpRequests

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 14, 2022
@poutsma poutsma self-assigned this Jul 14, 2022
@poutsma poutsma added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jul 14, 2022
@poutsma poutsma added this to the 5.3.23 milestone Jul 14, 2022
@poutsma poutsma added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants