AnsweredAssumed Answered

Random HTTP 400 error on POST request to alfresco

Question asked by ulxdanny on Jul 3, 2014
Latest reply on Jul 3, 2014 by ulxdanny
I got a problem with getting POST HTTP request in alfresco.


I send a request with YAHOO.asyncRequest to /share/proxy/alfresco/… and sometimes i got a 400 response code.
I always send the same request, and same parameters, so the problem is not here.
I debugged Alfresco's code, and i realesed that RemoteClient send the HTTP request to /alfresco/s/…?ALF_TICEKT=…, but if error occours i can't see the request on alfresco side. On response 400 recieved.

I tcpdumpped the request and if everything is alright i can see this:

<blockcode>
POST /alfresco/s/…/institution-registration?close=true&instID=2&alf_ticket=TICKET_1eb2ac478ba6b2389c831de9014d3ab4564e4855 HTTP/1.1
connection: keep-alive
content-length: 0
origin: http://dani-alf:8080
x-requested-with: application/json
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36
accept: */*
referer: http://dani-alf:8080/share/page/user/.../dashboard
accept-encoding: gzip,deflate,sdch
accept-language: hu-HU,hu;q=0.8,en-US;q=0.6,en;q=0.4
Content-Type: application/json
Host: localhost:8080
Expect: 100-continue


HTTP/1.1 100 Continue


HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Length: 133
Date: Thu, 03 Jul 2014 07:40:19 GMT



HTTP/1.1 400 Bad Request
Server: Apache-Coyote/1.1
Transfer-Encoding: chunked
Date: Thu, 03 Jul 2014 07:40:19 GMT
Connection: close


</blockcode>

If HTTP 400 occours:


POST /alfresco/s/…/institution-registration?close=true&instID=2&alf_ticket=TICKET_1eb2ac478ba6b2389c831de9014d3ab4564e4855 HTTP/1.1
connection: keep-alive
content-length: 0
origin: http://dani-alf:8080
x-requested-with: application/json
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36
accept: */*
referer: http://dani-alf:8080/share/page/user/.../dashboard
accept-encoding: gzip,deflate,sdch
accept-language: hu-HU,hu;q=0.8,en-US;q=0.6,en;q=0.4
Content-Type: application/json
Host: localhost:8080
Expect: 100-continue


In the logs:



DEBUG [webscripts.connector.HttpConnector] [http-bio-8080-exec-218] Requested Method: POST URI: /…/institution-registration?close=true&instID=2
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] Executing (POST) http://localhost:8080/alfresco/s/.../institution-registration?close=true&instID=2&alf_ticket=TICKET_1eb2ac478ba6b2389c831de9014d3ab4564e4855
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218]  - InputStream supplied - will push…
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218]  - OutputStream supplied - will stream response…
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218]  - OutputStream supplied - will stream response…
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218]  - Full Proxy mode between servlet request and response…
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] Creating HttpClient instance for thread: http-bio-8080-exec-218
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] Set Content-Type=application/json
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] POST entity Content-Length=-2
… MY CODE …
org.apache.coyote.http11.AbstractHttp11Processor process
INFO: Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] Response status code: 200
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] Response encoding: null
DEBUG [webscripts.connector.AuthenticatingConnector] [http-bio-8080-exec-218] Received 200 on first call to: /…/institution-registration?close=true&instID=2
DEBUG [servlet.mvc.EndPointProxyController] [http-bio-8080-exec-218] Return code: 200



Bad request log:


DEBUG [webscripts.connector.HttpConnector] [http-bio-8080-exec-112] Requested Method: POST URI: /…/institution-registration?close=true&instID=2
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112] Executing (POST) http://localhost:8080/alfresco/s/.../institution-registration?close=true&instID=2&alf_ticket=TICKET_1eb2ac478ba6b2389c831de9014d3ab4564e4855
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112]  - InputStream supplied - will push…
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112]  - OutputStream supplied - will stream response…
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112]  - Full Proxy mode between servlet request and response…
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112] Set Content-Type=application/json
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112] POST entity Content-Length=-2
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112] Response status code: 400
DEBUG [webscripts.connector.AuthenticatingConnector] [http-bio-8080-exec-112] Received 400 on first call to: /…/institution-registration?close=true&instID=2
DEBUG [servlet.mvc.EndPointProxyController] [http-bio-8080-exec-112] Return code: 400



i figured out that on GET requests it doesn't happen.
Any suggestion?

Outcomes