Why “Content-Length: 0” in POST requests?

后端 未结 13 1565
轻奢々
轻奢々 2020-11-28 05:50

A customer sometimes sends POST requests with Content-Length: 0 when submitting a form (10 to over 40 fields).

We tested it with different browsers and

13条回答
  •  旧时难觅i
    2020-11-28 06:07

    I also had a problem where requests from a customer's IE 11 browser had Content-Length: 0 and did not include the expected POST content. When the customer used Firefox, or Chrome the expected content was included in the request.

    I worked out the cause was the customer was using a HTTP URL instead of a HTTPS URL (e.g. http://..., not https://...) and our application uses HSTS. It seems there might be a bug in IE 11 that when a request gets upgraded to HTTPS due to HSTS the request content gets lost.

    Getting the customer to correct the URL to https://... resulted in the content being included in the POST request and resolved the problem.

    I haven't investigated whether it is actually a bug in IE 11 any further at this stage.

提交回复
热议问题