是否有可能添加一个端口在其中的pushEndpoint?

我正在尝试在Google的PubSub( https://cloud.google.com/pubsub/ )中尝试添加pushEndpoint,以便我能够接收来自Gmail的推送更新。 我试图添加的pushEndpoint是一个带有端口的HTTPS-URL(例如: https : //developers.example.com :9081/pushEndpoint),但我一直得到Invalid push endpoint given (endpoint=https://developers.briteback.com:9081/mailSyncHandler). Refer to https://cloud.google.com/pubsub/subscriber#create for more information. Invalid push endpoint given (endpoint=https://developers.briteback.com:9081/mailSyncHandler). Refer to https://cloud.google.com/pubsub/subscriber#create for more information.

所以问题是如果有可能添加一个端口到pushEndpoint?

以下是试图创build订阅的代码:

 var rp = require('request-promise'); rp({ url: 'https://pubsub.googleapis.com/v1/projects/projectId/subscriptions/mailSync', method: 'PUT', headers: { Authorization: 'Bearer accessToken' }, json: { topic: 'projects/projectId/topics/mailSync', pushConfig: { pushEndpoint: 'https://developers.example.com:9081/mailSyncHandler' } } }) .then(function(response) { console.log(response); res.send(response); }) .catch(function(err) { console.error(err); res.status(err.statusCode).send(err.error.error.message); }); 

所以看起来不可能将端口添加到pushEndpoint。 我最终做的是创build一个反向代理(使用node-http-proxy)来侦听端口443,并将/ mailSyncHandler转发到我们networking中的正确地址。