Skip to content

WebFlux Cloud Foundry links endpoint includes query string from received request in resolved links#50008

Merged
wilkinsona merged 2 commits intospring-projects:3.5.xfrom
dlwldnjs1009:fix/cf-reactive-links-query-string
Apr 10, 2026
Merged

WebFlux Cloud Foundry links endpoint includes query string from received request in resolved links#50008
wilkinsona merged 2 commits intospring-projects:3.5.xfrom
dlwldnjs1009:fix/cf-reactive-links-query-string

Conversation

@dlwldnjs1009
Copy link
Copy Markdown
Contributor

@dlwldnjs1009 dlwldnjs1009 commented Apr 10, 2026

Summary

  • CloudFoundryLinksHandler#links includes the request query string when resolving endpoint links
  • This causes generated link hrefs to contain the query (for example, /cfApplication?x=1/info instead of /cfApplication/info)
  • The standard WebFlux sibling uses UriComponentsBuilder.fromUri(...).replaceQuery(null) to strip the query, and the Cloud Foundry servlet sibling uses getRequestURL() which excludes the query by Servlet spec
  • Applied the same replaceQuery(null) pattern and added a regression test verifying self, info, and env link hrefs remain query-free

Test plan

  • CloudFoundryWebFluxEndpointIntegrationTests passes (including new linksToOtherEndpointsWithQueryStringShouldNotContainQueryInHref)
  • checkFormatMain and checkFormatTest pass

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 10, 2026
@dlwldnjs1009 dlwldnjs1009 force-pushed the fix/cf-reactive-links-query-string branch from 3d93917 to 0817f42 Compare April 10, 2026 05:30
@wilkinsona wilkinsona changed the title Strip query string from Cloud Foundry reactive links base URL CloudFoundry links endpoint includes query string from received request in resolved links Apr 10, 2026
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 10, 2026
@wilkinsona wilkinsona added this to the 3.5.x milestone Apr 10, 2026
@wilkinsona wilkinsona self-assigned this Apr 10, 2026
@wilkinsona wilkinsona force-pushed the fix/cf-reactive-links-query-string branch from 0817f42 to eea1aa1 Compare April 10, 2026 10:30
@wilkinsona wilkinsona changed the base branch from main to 3.5.x April 10, 2026 10:32
CloudFoundryLinksHandler passes request.getURI().toString() directly
to EndpointLinksResolver.resolveLinks(), which includes the query
string. This causes generated link hrefs to contain the query
(for example, "/cfApplication?x=1/info"). The standard WebFlux and
Cloud Foundry servlet siblings already strip the query before
resolving links.

Use UriComponentsBuilder.replaceQuery(null) to match the pattern used
by WebFluxEndpointHandlerMapping and add a regression test for a
query-string request.

Signed-off-by: Lee JiWon <dlwldnjs1009@gmail.com>

See spring-projectsgh-50008
@wilkinsona wilkinsona changed the title CloudFoundry links endpoint includes query string from received request in resolved links WebFlux Cloud Foundry links endpoint includes query string from received request in resolved links Apr 10, 2026
This commit polishes the proposed test for the WebFlux Cloud Foundry
endpoint. To protect against future regressions, it also adds tests
for the general purpose links endpoints (WebFlux, Web MVC, and
Jersey) and for the Web MVC Cloud Foundry endpoint.

See spring-projectsgh-50008
@wilkinsona wilkinsona force-pushed the fix/cf-reactive-links-query-string branch from eea1aa1 to f63f6d7 Compare April 10, 2026 11:28
@wilkinsona wilkinsona modified the milestones: 3.5.x, 3.5.14 Apr 10, 2026
@wilkinsona wilkinsona merged commit ddffe42 into spring-projects:3.5.x Apr 10, 2026
3 of 4 checks passed
@wilkinsona
Copy link
Copy Markdown
Member

Thank you, @dlwldnjs1009.

@dlwldnjs1009 dlwldnjs1009 deleted the fix/cf-reactive-links-query-string branch April 10, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants