Forum Discussion

stefdaems's avatar
stefdaems
New Member
9 years ago

302 Moved Temporarily - response on POST request

When I'm performing a post request which should lead to a redirect, the redirect isn't handled propertly.

 

RAW format of request

----------------------------

POST https://XXX.XXX.XXX.XXX:8443/Manager/securitycheck.vod HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 37
Host: XXX.XXX.XXX.XXX:8443
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.3.1 (java 1.5)

 

j_username=testuser&j_password=testpass

 

With "Follow Redirects" set to false, request above is responded with "HTTP/1.1 302 Moved Temporarily"

 

Logs

------

  • Tue Oct 06 10:38:58 CEST 2015:DEBUG: >> "POST /Manager/securitycheck.vod HTTP/1.1[\r][\n]"
  • Tue Oct 06 10:38:58 CEST 2015:DEBUG: >> "Accept-Encoding: gzip,deflate[\r][\n]"
  • Tue Oct 06 10:38:58 CEST 2015:DEBUG: >> "Content-Type: application/x-www-form-urlencoded [\r][\n]"
  • Tue Oct 06 10:38:58 CEST 2015:DEBUG: >> "Content-Length: 37[\r][\n]"
  • Tue Oct 06 10:38:58 CEST 2015:DEBUG: >> "Host: XXX.XXX.XXX.XXX:8443[\r][\n]"
  • Tue Oct 06 10:38:58 CEST 2015:DEBUG: >> "Connection: Keep-Alive[\r][\n]"
  • Tue Oct 06 10:38:58 CEST 2015:DEBUG: >> "User-Agent: Apache-HttpClient/4.3.1 (java 1.5)[\r][\n]"
  • Tue Oct 06 10:38:58 CEST 2015:DEBUG: >> "[\r][\n]"
  • Tue Oct 06 10:38:58 CEST 2015:DEBUG: >> "j_username=testuser&j_password=testpass"
  • Tue Oct 06 10:39:03 CEST 2015:DEBUG: << "HTTP/1.1 302 Moved Temporarily[\r][\n]"
  • Tue Oct 06 10:39:03 CEST 2015:DEBUG: << "Server: Apache-Coyote/1.1[\r][\n]"
  • Tue Oct 06 10:39:03 CEST 2015:DEBUG: << "Set-Cookie: JSESSIONID=444269D02E53BB0155909417A5DAF809; Path=/Manager; Secure[\r][\n]"
  • Tue Oct 06 10:39:03 CEST 2015:DEBUG: << "Location: https://XXX.XXX.XXX.XXX:8443/Manager/lay.vod;jsessionid=444269D02E53BB0155909417A5DAF809[\r][\n]"
  • Tue Oct 06 10:39:03 CEST 2015:DEBUG: << "Content-Language: en-US[\r][\n]"
  • Tue Oct 06 10:39:03 CEST 2015:DEBUG: << "Content-Length: 0[\r][\n]"
  • Tue Oct 06 10:39:03 CEST 2015:DEBUG: << "Date: Tue, 06 Oct 2015 08:39:03 GMT[\r][\n]"
  • Tue Oct 06 10:39:03 CEST 2015:DEBUG: << "[\r][\n]"

 

Whenever the "Follow Redirects" is set to true I'm hitting a 400 bad request.

 

  • Tue Oct 06 10:40:54 CEST 2015:DEBUG: >> "POST /Manager/securitycheck.vod HTTP/1.1[\r][\n]"
  • Tue Oct 06 10:40:54 CEST 2015:DEBUG: >> "Accept-Encoding: gzip,deflate[\r][\n]"
  • Tue Oct 06 10:40:54 CEST 2015:DEBUG: >> "Content-Type: application/x-www-form-urlencoded [\r][\n]"
  • Tue Oct 06 10:40:54 CEST 2015:DEBUG: >> "Content-Length: 37[\r][\n]"
  • Tue Oct 06 10:40:54 CEST 2015:DEBUG: >> "Host: XXX.XXX.XXX.XXX:8443[\r][\n]"
  • Tue Oct 06 10:40:54 CEST 2015:DEBUG: >> "Connection: Keep-Alive[\r][\n]"
  • Tue Oct 06 10:40:54 CEST 2015:DEBUG: >> "User-Agent: Apache-HttpClient/4.3.1 (java 1.5)[\r][\n]"
  • Tue Oct 06 10:40:54 CEST 2015:DEBUG: >> "[\r][\n]"
  • Tue Oct 06 10:40:54 CEST 2015:DEBUG: >> "j_username=testuser&j_password=testpass"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "HTTP/1.1 302 Moved Temporarily[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "Server: Apache-Coyote/1.1[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "Set-Cookie: JSESSIONID=AD2E5269FB5E759E49BFB4B9A927DDFD; Path=/DVRManager; Secure[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "Location: https://XXX.XXX.XXX.XXX:8443/Manager/lay.vod;jsessionid=AD2E5269FB5E759E49BFB4B9A927DDFD[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "Content-Language: en-US[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "Content-Length: 0[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "Date: Tue, 06 Oct 2015 08:40:58 GMT[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: >> "POST /Manager/lay.vod;jsessionid=AD2E5269FB5E759E49BFB4B9A927DDFD HTTP/1.1[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: >> "Accept-Encoding: gzip,deflate[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: >> "Content-Type: application/json[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: >> "Host: XXX.XXX.XXX.XXX[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: >> "Content-Length: 37[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: >> "Connection: Keep-Alive[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: >> "User-Agent: Apache-HttpClient/4.3.1 (java 1.5)[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: >> "Cookie: JSESSIONID=AD2E5269FB5E759E49BFB4B9A927DDFD[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: >> "Cookie2: $Version=1[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: >> "[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: >> "j_username=testuser&j_password=testpass"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "HTTP/1.1 400 Bad Request[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "Server: Apache-Coyote/1.1[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "Content-Type: text/html;charset=utf-8[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "Content-Length: 971[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "Date: Tue, 06 Oct 2015 08:40:58 GMT[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "Connection: close[\r][\n]"
  • Tue Oct 06 10:40:58 CEST 2015:DEBUG: << "[\r][\n]"

 

HTTP Status 400 -


type Status report

message

description The request sent by the client was syntactically incorrect ().


Apache Tomcat/6.0.24

 

 

Any idea how the redirect could be handled properly? When I'm executing the same POST request in Fiddler, the request is correctly executed.

 

Br,
Stef

No RepliesBe the first to reply