【发布时间】:2018-07-20 02:42:33
【问题描述】:
我有一个带有可信 SSL 证书版本 3 的网站。我从 SSL 颁发者那里获得了 4 个文件,其中一个是放在服务器上的域证书。
为我尝试过的机器人设置 webhook:
-
URL模式下的简单setWebhook方法:
https://api.telegram.org/bot447278997:*******************************nZW0/setWebhook?url=https://example.com/webhookMethod -
setWebhook使用卷曲。我已经上传了来自证书颁发者的 4 个文件中的每一个,以及一个包含所有 4 个随机顺序文件的文件。 (curl 命令将我的证书识别为自签名证书并返回 SSL(60) 错误,因此我必须在命令中添加一个--insecure字词以忽略证书的验证并发送它)。这是命令:curl --insecure -F "url=https://example.com/webhookMethod" -F "certificate=@cert.pem" https://api.telegram.org/bot447278997:****************************nZW0/setWebhook
以上方法都没有使我的 webhook 工作。调用getWebhookInfo方法,每次都报错:
{
"ok":true,
"result":{
"url":"https://example.com/webhookMethod",
"has_custom_certificate":true,
"pending_update_count":7,
"last_error_date":1518169667,
"last_error_message":"Wrong response from the webhook: 302 Found",
"max_connections":40
}
}
在某些尝试中,has_custom_certificate 变成了 False 或 last_error_message 更改为 not verified certificate 或 SSL error 等。
此外,我已经使用具有 SSL 验证的 Postman 测试了我的 Web 服务,并且一切都已设置好并且可以正常工作。 我也知道 Telegram 不支持 SSL 版本 2 和 3,但支持自签名证书。现在我要向他们发送经过验证的第 3 版证书,它应该可以工作,对吧?
提前感谢任何帮助。
【问题讨论】:
-
请正确格式化您的代码。
-
错误提示您返回 302(而不是 200)。为什么你认为这是 SSL 问题?
标签: curl ssl-certificate telegram telegram-bot telegram-webhook