Repository navigation
fix(webapp): keep already encoded characters in proxied URLs - #2302
Conversation
Signed-off-by: Artem Stroitelev <[email protected]>
|
👋 @PunKHS Welcome to the Microcks community! 💖 Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly. Hope you have a great time there! |
|
No errors ... that was a flaky integration test. Ready to merge! Thanks! |
|
🎉 @PunKHS You are now a Microcks community contributor! 💖 Thanks and congrats 🚀 on merging your first pull request! We are delighted and very proud of you! 👏 📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact. If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌" Kudos and please keep going, we need you 🙌 |
Description
Fixes #2291
With the
PROXYorPROXY_FALLBACKdispatcher, aproxyUrlthat already contains percent-encoded characters wasencoded a second time on the outbound request:
%3Abecame%253A,%2Fbecame%252F, and the query string had the same problem. Backends whose resource identifier must stay encoded inside a single path segment then resolve anon-existent resource and return
404.MockControllerCommons.getProxyUrlIfProxyIsNeeded()built the URI withUriComponentsBuilder.build(), which marks the components as not encoded, sotoUri()uses the multi-argsjava.net.URIconstructor that quotes%again.Changes
MockControllerCommons.java: build withbuild(true)theproxyUrl, the incoming resource path and the query string are already URI encoded, so they are assembled as-is.Fixes
PROXYandPROXY_FALLBACKfor the REST, SOAP and GraphQL invocation processors at once. Proxy URLs that are not valid URI syntax now hit the existingInvalid external URL in the dispatcherbranch instead of being silently encoded.Tests
MockControllerCommonsTest.ProxyUrlTests(7 tests): encodedPROXYurl, resource path appending, encoded querystring, encoded
PROXY_FALLBACKurl and the three no-proxy cases (response found, no proxy dispatcher, external urlequal to the incoming one).
RestInvocationProcessorTest.shouldProxyRequestWithEncodedProxyUrl: asserts theURIhanded toProxyService.callExternal()keeps its raw path and raw query.mvn -pl webapp -am -Dtest=MockControllerCommonsTest,RestInvocationProcessorTest -Dsurefire.failIfNoSpecifiedTests=false testPrepared with the assistance of an AI coding agent. Reviewed, tested and owned by the human author.