Skip to content

prefixPath filter double encodes URLs #3769

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

Closed
SebHeuze opened this issue Apr 15, 2025 · 2 comments · Fixed by #3770
Closed

prefixPath filter double encodes URLs #3769

SebHeuze opened this issue Apr 15, 2025 · 2 comments · Fixed by #3770
Labels
Milestone

Comments

@SebHeuze
Copy link
Contributor

Describe the bug
In last version of Spring Gateway MVC, prefixPath filter does not support Encoded url like "/url with/space"
The path is transformed to "/url%2520with/space" instead of "/url%20with/space"
The filter should use getPath instead of getRawPath

Similar to #3482

Sample
Adding this test in BeforeFilterFunctionsTests reproduce the issue

@Test
void prefixEncodedPath() {
	MockHttpServletRequest servletRequest = MockMvcRequestBuilders
			.get("http://localhost/get/é").buildRequest(null);
	ServerRequest request = ServerRequest.create(servletRequest,
			Collections.emptyList());
	ServerRequest modified = BeforeFilterFunctions.prefixPath("/pre fix")
			.apply(request);
	assertThat(modified.uri().getRawPath()).isEqualTo("/pre%20fix/get/%C3%A9");
}
SebHeuze added a commit to SebHeuze/spring-cloud-gateway that referenced this issue Apr 15, 2025
SebHeuze added a commit to SebHeuze/spring-cloud-gateway that referenced this issue Apr 15, 2025
SebHeuze added a commit to SebHeuze/spring-cloud-gateway that referenced this issue Apr 15, 2025
SebHeuze added a commit to SebHeuze/spring-cloud-gateway that referenced this issue Apr 15, 2025
@joaquinjsb
Copy link

same as #3759

@joaquinjsb
Copy link

@spencergibb sorry to ping you directly, but could we get an update on this issue? It's become a blocker for us. Any estimate on when you might have time to take a look would be appreciated. Thanks!

SebHeuze added a commit to SebHeuze/spring-cloud-gateway that referenced this issue May 5, 2025
@ryanjbaxter ryanjbaxter added this to the 4.1.8 milestone May 12, 2025
ryanjbaxter added a commit that referenced this issue May 13, 2025
@github-project-automation github-project-automation bot moved this to Done in 2023.0.6 May 13, 2025
@github-project-automation github-project-automation bot moved this to Done in 2025.0.0 May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Status: No status
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants