是否可以添加一个带有端口的 pushEndpoint?
Is it possible to add a pushEndpoint that has a port in it?
我正在尝试将 pushEndpoint 添加到我试图在 Google 的 PubSub (https://cloud.google.com/pubsub/) so I'm able to receive push updates from Gmail. The pushEndpoint I'm trying to add is an HTTPS-URL with a port (e.g.: 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.
所以问题是是否可以将端口添加到 pushEndpoint?
这是尝试创建订阅的代码:
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。我最终做的是创建一个反向代理(带有 node-http-proxy),它在端口 443 上侦听并将 /mailSyncHandler 转发到我们网络中的正确地址。
我正在尝试将 pushEndpoint 添加到我试图在 Google 的 PubSub (https://cloud.google.com/pubsub/) so I'm able to receive push updates from Gmail. The pushEndpoint I'm trying to add is an HTTPS-URL with a port (e.g.: 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.
所以问题是是否可以将端口添加到 pushEndpoint?
这是尝试创建订阅的代码:
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。我最终做的是创建一个反向代理(带有 node-http-proxy),它在端口 443 上侦听并将 /mailSyncHandler 转发到我们网络中的正确地址。