Rails API App ignores Accept-Language header value

This is all at the Controller level, ie ApplicationController.

This is a really strange issue which may only be occurring to me.

Basically, as the title says Rails is ignoring the Accept-Language header value. But get this, order matters apparently.

So if I curl

curl -X POST \
 http://localhost:1234/signin \
 -H 'Accept-Language: de' \
 -H 'content-type: application/json' \
 -H 'Test-Header: Test' \

I can access the Accept-Language value with request.headers['Accept-Language'] perfectly fine.

However, if I change the order

curl -X POST \
 http://localhost:1234/signin \
 -H 'content-type: application/json' \
 -H 'Accept-Language: de' \
 -H 'Test-Header: Test' \

request.headers['Accept-Language'] returns nil.

Any idea as to why this may happen? I'm on Rails 3.2.22.1

Things I've done:

  • Checked the Rack::Cors middleware
  • Pulled out my hair
  • Verified header is sent both on curl and web, also verified my findings with Postman
  • Global search to see if it gets overwritten anywhere (I couldn't find anything)
  • Other header values are fine. I didn't test all of them but did test custom and a handful of others.

Thanks in advance!