Mostafa Khattab
Mostafa Khattab

Reputation: 554

gcloud can't send custom https header data

I am working on cloud app using nodeJs, I am sending data in the request body, and send secret key in the header request.

Then I check and validate the secret key that I sent in the header, when I run the app locally over 127.0.0.1:8080/ I got every thing running well. But, when I deploy the app to the cloud, it doesn't work. It doesn't see the metadata (variables) that I send inside the https request.

Any solution ??

Upvotes: 0

Views: 104

Answers (2)

callmehiphop
callmehiphop

Reputation: 646

You should be able to use interceptors to add custom headers

var gcloud = require('gcloud')({
  projectId: 'grape-spaceship-123',
  keyFilename: '/path/to/keyfile.json'
});

gcloud.interceptors.push({
  request: function(requestOptions) {
    requestOptions.headers = requestOptions.headers || {};
    requestOptions.headers['x-secret-key'] = 'yahtzee';
    return requestOptions;
  }
});

Upvotes: 1

Mostafa Khattab
Mostafa Khattab

Reputation: 554

It seems that gcloud reject underscore character in the header key parameter.

Upvotes: 0

Related Questions