Contributions
Wrong redirect in HTTP request with several following redirects
Hi, I have an issue with an GET HTTP Request following 2 Redirects. Target Host is https://localhost:9443 always. But during Redirects the Host-Header looses the port 9443, that results in failed second redirect: Wed Nov 25 10:55:56 CET 2015:DEBUG:>> "GET /oauth2/authorize?response_type=code&client_id=26hADivDiGUzPdD2GEyZw7sRg3Ea&scope=test&redirect_uri=http%3A%2F%2Flocalhost%3A9830%2F&state=state12345678 HTTP/1.1[\r][\n]" Wed Nov 25 10:55:56 CET 2015:DEBUG:>> "Connection: close[\r][\n]" Wed Nov 25 10:55:56 CET 2015:DEBUG:>> "Accept-Encoding: gzip,deflate[\r][\n]" Wed Nov 25 10:55:56 CET 2015:DEBUG:>> "Content-Type: application/x-www-form-urlencoded;charset=UTF-8[\r][\n]" Wed Nov 25 10:55:56 CET 2015:DEBUG:>> "Host: localhost:9443[\r][\n]" Wed Nov 25 10:55:56 CET 2015:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]" Wed Nov 25 10:55:56 CET 2015:DEBUG:>> "[\r][\n]" Wed Nov 25 10:56:05 CET 2015:DEBUG:<< "HTTP/1.1 302 Found[\r][\n]" Wed Nov 25 10:56:05 CET 2015:DEBUG:<< "Date: Wed, 25 Nov 2015 09:56:05 GMT[\r][\n]" Wed Nov 25 10:56:05 CET 2015:DEBUG:<< "Location: https://localhost:9443/commonauth/?sessionDataKey=c38b3b4d-805a-4d3b-8321-419daf8f7201&type=oauth2[\r][\n]" Wed Nov 25 10:56:05 CET 2015:DEBUG:<< "Content-Length: 0[\r][\n]" Wed Nov 25 10:56:05 CET 2015:DEBUG:<< "Connection: close[\r][\n]" Wed Nov 25 10:56:05 CET 2015:DEBUG:<< "Server: TestServer[\r][\n]" Wed Nov 25 10:56:05 CET 2015:DEBUG:<< "[\r][\n]" Wed Nov 25 10:56:05 CET 2015:DEBUG:>> "GET /commonauth/?sessionDataKey=c38b3b4d-805a-4d3b-8321-419daf8f7201&type=oauth2 HTTP/1.1[\r][\n]" Wed Nov 25 10:56:05 CET 2015:DEBUG:>> "Host: localhost[\r][\n]" Wed Nov 25 10:56:05 CET 2015:DEBUG:>> "Connection: Keep-Alive[\r][\n]" Wed Nov 25 10:56:05 CET 2015:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]" Wed Nov 25 10:56:05 CET 2015:DEBUG:>> "[\r][\n]" Wed Nov 25 10:56:10 CET 2015:DEBUG:<< "HTTP/1.1 302 Found[\r][\n]" Wed Nov 25 10:56:10 CET 2015:DEBUG:<< "Location: https://localhost/authenticationendpoint/login.do?client_id=26hADivDiGUzPdD2GEyZw7sRg3Ea&commonAuthCallerPath=%2Foauth2%2Fauthorize&forceAuth=false&passiveAuth=false&redirect_uri=http%3A%2F%2Flocalhost%3A9830%2F&relyingParty=26hADivDiGUzPdD2GEyZw7sRg3Ea&response_type=code&scope=iamTestScope&state=state12345678&tenantId=-1234&type=oauth2&sessionDataKey=956cc0e2-60c8-4bc5-999f-d62f2697521c&relyingParty=26hADivDiGUzPdD2GEyZw7sRg3Ea&type=oauth2&sp=TryItSP&isSaaSApp=false&authenticators=BasicAuthenticator:LOCAL[\r][\n]" Wed Nov 25 10:56:10 CET 2015:DEBUG:<< "Content-Type: text/html;charset=UTF-8[\r][\n]" Wed Nov 25 10:56:10 CET 2015:DEBUG:<< "Content-Length: 0[\r][\n]" Wed Nov 25 10:56:10 CET 2015:DEBUG:<< "Date: Wed, 25 Nov 2015 09:56:10 GMT[\r][\n]" Wed Nov 25 10:56:10 CET 2015:DEBUG:<< "Server: TestServer[\r][\n]" Wed Nov 25 10:56:10 CET 2015:DEBUG:<< "[\r][\n]" Following Error Message after 2. Redirect: org.apache.http.conn.HttpHostConnectException: Connection to https://localhost refused I tried same scenario with standard https port and a remote address. This is working fine. I only have trouble with localhost... Testing same scenario withn any other test client is working fine. This let me raise the question, whether it is a bug in SOAP-UI. It seems Host-Header is set the wrong way: https://github.com/SmartBear/soapui/blob/000369b9555939062fc2db45db10dbb452c4e7fe/soapui/src/main/java/com/eviware/soapui/impl/wsdl/submit/transports/http/HttpClientRequestTransport.java#L328 It should also contain "uri.getPort()". Regards, Edgar1.7KViews0likes1Comment