No header variables in production

I am running Rails 3.1 with PhusionPassenger and NGINX in the back. I am sending requests through a simple HttpClient (GrahpicalHttpClient for OS X). My code expects a token and id in the header to verify the identity of the caller. In development mode, this is not a problem, but as soon as I translate it into production, the header variables disappear. Nothing is displayed.

Here is the code:

@caller = Person.check_authentication_token(request.headers['person_id'], request.headers['authentication_token']) 

The check_authentication_token method returns nil if any variable is nil. As I said, this works fine in development, but request.headers ['person_id'] and request.headers ['authentication_token'] are zero in production. Has anyone else seen this problem before?

+3
ruby-on-rails-3 nginx passenger
source share
1 answer

Nginx by default considers defects in request headers invalid and subsequently deletes them, see http://wiki.nginx.org/HttpCoreModule#underscores_in_headers to fix this.

+12
source share

All Articles