0

I have created a simple .NET core Web API, which runs perfectly on localhost. Whenever i deploy the docker image to our server (Jelastic) and POST to the only POST endpoint i get failure.

The error is as follows:

 INFO  02:41:14 Connection id "0HLOLOJQ1QFRM" bad request data: "Requests with 'Connection: Upgrade' cannot have content in the request body."
Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Requests with 'Connection: Upgrade' cannot have content in the request body.
   at Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException.Throw(RequestRejectionReason reason)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1MessageBody.For(HttpVersion httpVersion, HttpRequestHeaders headers, Http1Connection context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.CreateMessageBody()
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync[TContext](IHttpApplication`1 application)

All GET requests succeeds without a problem.

[HttpPost]
public ActionResult<List<string>> Post([FromBody]Dictionary<string, string> data)
{
    //LOGIC
}

I don't think there is a reverse proxy (NGINX or similar) and everything is handled by Kestrel.

My requests is:

POST /api/word HTTP/1.1
Host: *our server*
Content-Type: application/json
User-Agent: PostmanRuntime/7.15.2
Accept: */*
Cache-Control: no-cache
Postman-Token: 9d575404-6347-4783-a03f-cba29f9113e8,b8a94c5d-1ee5-42c4-a2e4-348c9af0e064
Host: *our server*
Accept-Encoding: gzip, deflate
Content-Length: 110
Connection: keep-alive
cache-control: no-cache

{
"customerName": "test-entries",
"reportPeriod": "test-entries"
}

This fails when using CURL as well. What could be overlooked here?

mjwills
  • 23,389
  • 6
  • 40
  • 63
Maarten
  • 660
  • 1
  • 6
  • 21

1 Answers1

1

It appears it indeed was a Jelastic proxy as @mjwills stated in the comments. In Jelastic i have registered an endpoint that maps port 80 in the container to 11000 publicly and the problems seems solved. It appears that the proxy/mapping/rerouting in Jelastic altered the request.

Maarten
  • 660
  • 1
  • 6
  • 21