{"record":{"id":"5785c3c5e6df22f2","repo":"zaproxy/zaproxy","slug":"invalid-redirect-location-location","errorCode":null,"errorMessage":"Invalid redirect location: <location>","messagePattern":"Invalid redirect location: <location>","errorType":"exception","errorClass":"InvalidRedirectLocationException","httpStatus":null,"severity":"error","filePath":"zap/src/main/java/org/apache/commons/httpclient/HttpMethodDirector.java","lineNumber":711,"sourceCode":"            }\n\t\t\t\n            if (redirectUri.isRelativeURI()) {\n\t\t\t\tif (this.params.isParameterTrue(HttpClientParams.REJECT_RELATIVE_REDIRECT)) {\n\t\t\t\t\tLOG.warn(\"Relative redirect location '\" + location + \"' not allowed\");\n\t\t\t\t\treturn false;\n\t\t\t\t} else { \n\t\t\t\t\t//location is incomplete, use current values for defaults\n\t\t\t\t\tLOG.debug(\"Redirect URI is not absolute - parsing as relative\");\n\t\t\t\t\tredirectUri = new URI(currentUri, redirectUri);\n\t\t\t\t}\n\t\t\t} else {\n                // Reset the default params\n                method.getParams().setDefaults(this.params);\n            }\n            method.setURI(redirectUri);\n            hostConfiguration.setHost(redirectUri);\n\t\t} catch (URIException ex) {\n            throw new InvalidRedirectLocationException(\n                    \"Invalid redirect location: \" + location, location, ex);\n\t\t}\n\n        if (this.params.isParameterFalse(HttpClientParams.ALLOW_CIRCULAR_REDIRECTS)) {\n            if (this.redirectLocations == null) {\n                this.redirectLocations = new HashSet<>();\n            }\n            this.redirectLocations.add(currentUri);\n            try {\n                if(redirectUri.hasQuery()) {\n                    redirectUri.setQuery(null);\n                }\n            } catch (URIException e) {\n                // Should never happen\n                return false;\n            }\n\n            if (this.redirectLocations.contains(redirectUri)) {","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/zaproxy/zaproxy/blob/9d1970a436b1b189bfb588fc88864c80d9baf6a5/zap/src/main/java/org/apache/commons/httpclient/HttpMethodDirector.java#L693-L729","documentation":"Thrown by processRedirectResponse when the Location header of an HTTP 3xx redirect cannot be parsed into a valid URI. Fires during executeMethod when the server returns a malformed or unresolvable redirect target, so the redirect cannot be followed.","triggerScenarios":"Thrown at zap/src/main/java/org/apache/commons/httpclient/HttpMethodDirector.java:711 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the Location header returned by the server and fix it if you control the server","Enable lenient redirect handling or disable automatic redirect following and resolve the location manually","Upgrade the HttpClient/URI parser if the location uses syntax the old parser rejects"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d1970a436b1b189bfb588fc88864c80d9baf6a5","analyzedAt":"2026-09-05T19:26:59.356Z","contentChangedAt":"2026-09-05T19:26:59.356Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}