Closed ShaneLee closed 4 months ago
I am still getting incorrect request URI with this solution. The problem is that targetUrl
is not completely encoded, some characters are decoded by the servlet.getServletPath()
method and are passed decoded into the server. (For example Unicode characters.) It causes the target server to fail.
I found a solution - targetUrl
should be encoded which can be achieved by replacing servlet.getServletPath()
with servlet.getRequestURI()
in ProxyTargetUrlBuilder
class (instead of the change in this PR):
return new URL(chaosProxyConfigurationService.getDestinationServiceHostProtocolAndPort() + request.getRequestURI());
EDIT: How I tested: started a Python server python3 -m http.server 8080
in a folder with files containing Unicode chars in name, configured it as ChaosProxy destination and tried to download these files.
Thought I'd have a look at this issue (#3 )
The fix in this pull request means that calls with encoded curly brackets now returns a 404 not found error and doesn't crash the system with a 500 error.
Haven't incremented the version number in the POM as it looks like it's staying at '0.0.1-SNAPSHOT', but happy to change if required.