5

I am using AWS Cloudfront and API gateway for a file upload API. I have deployed same code to two different but identical environments. Both the environments are built by the same cloudformation script. We are having a weird issue

When we are uploading file in environment A, we are getting following request

 "headers": {
    
    "content-type": "multipart/form-data; boundary=----WebKitFormBoundarygPe3hR4e1dTzLdBt",

However in environment B I am getting following

 "headers": {
   
    "Content-Type": "multipart/form-data; boundary=----WebKitFormBoundarygPe3hR4e1dTzLdBt",

The difference is Content-Type. In Environment A, I am getting Content-Type in lower case. Not sure why. This behavior is consistent across all browsers.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Hitesh
  • 512
  • 6
  • 24

2 Answers2

0

I have just found the same issue.

With a REST Private API: "Content-Type" With a REST Public API: "content-type"

jono2010
  • 602
  • 1
  • 7
  • 13
0

I stumbled upon this question having myself problems with case of header names. I don't know what causes the difference between the two environments, but as cited elsewhere in SO, i.e.: Are HTTP headers case-sensitive? HTTP headers in HTTP 1.1 should be treated with case insensitivity.

That means that if you want your application to be fully HTTP1.1 compliant, it have to behave exactly the same regardless of the actual case of the headers.

So, from a standard point of view, your app is not fully compliant with HTTP1.1.

danidemi
  • 4,404
  • 4
  • 34
  • 40