Telegram Bot Webhook 未验证我的 SSL 证书
Telegram Bot Webhook Not Verifying My SSL Certificate
我有一个带有受信任的 SSL 证书版本 3 的网站。我从 SSL 颁发者那里获得了 4 个文件,其中之一是服务器上的域证书。
我试过为我的机器人设置 webhook:
URL模式下的简单setWebhook方法:
https://api.telegram.org/bot447278997:*******************************nZW0/setWebhook?url=https://example.com/webhookMethod
setWebhook
使用 Curl。我已经上传了来自证书颁发者的 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
None 上述方法使我的 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 版证书,它应该可以使用,对吧?
提前感谢任何帮助。
这不是 ssl 问题。你应该 return 200 在响应而不是 302。据我所知,302 意味着重定向。不要在响应消息中重定向。
我有一个带有受信任的 SSL 证书版本 3 的网站。我从 SSL 颁发者那里获得了 4 个文件,其中之一是服务器上的域证书。
我试过为我的机器人设置 webhook:
URL模式下的简单setWebhook方法:
https://api.telegram.org/bot447278997:*******************************nZW0/setWebhook?url=https://example.com/webhookMethod
setWebhook
使用 Curl。我已经上传了来自证书颁发者的 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
None 上述方法使我的 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 版证书,它应该可以使用,对吧?
提前感谢任何帮助。
这不是 ssl 问题。你应该 return 200 在响应而不是 302。据我所知,302 意味着重定向。不要在响应消息中重定向。