Mangling of headers in GRPC calls

I’ve followed the “Create Custom Authentication Plugin with NodeJS” guide from Here

One thing I’ve noticed that the headers are mangled in an awkward way.

For example is the following call was issued:
curl -H "Authorization: token" -H "GPRC-Authorization: token2"

From the GRPC handler, I am seeing the headers are mangled to capitalized kabab case instead of what was passed in via the headers.

{ hook_type: 'CustomKeyCheck',
  hook_name: 'MyAuthMiddleware',
   { headers:
      { Mycustomheader: 'mycustomvalue here!',
        'User-Agent': 'curl/7.54.0',
        Accept: '*/*',
        Authorization: 'token',
        'Gprc-Authorization': 'token2',
        Host: '' },

The above was logged from:

const authMiddleware = (obj, callback) => {
  var req = obj.request

I am curious if there are ways to stop this behaviour or standardize the keys to all lower case, since header keys are case insensitive.

1 Like


This will be down to how golang handles header prsing - it automatically turns all headers into capital case like this when it is parsing them.

The good news is that it is consistent, so you’ll always find headers will become Capitalise-Case no matter what you pass in.

1 Like