Telegram Webhook called by http:// instead https://

65 views Asked by At

I have created Telegram bot, and try to connect it with my web. I have stuck on webhook step.

My app is

  • running on Symfony 5.4
  • For Bot API i've choosed klev-o/telegram-bot-api
  • Mysql 5.7
  • cloudflare certificate.
  • configured webhook:
 Klev\TelegramBotApi\Types\WebhookInfo {#702 ▼
  +url: "https://example.com/api/webhooks/telegram"
  +has_custom_certificate: false
  +pending_update_count: 2
  +last_error_date: 1698934939
  +last_error_message: "Wrong response from the webhook: 301 Moved Permanently"
  +max_connections: 1
  +last_synchronization_error_date: null
  +allowed_updates: null
}

Issue:

  • When Telegram triggers webhook, he make request on http://example.com/api/webhooks/telegram instead https://example.com/api/webhooks/telegram

Therefore my api can't proceed webhook action

Request Log:

request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "POST http://example.com/api/webhooks/telegram"" at /var/www/app/public_html/vendor/symfony/http-kernel/EventListener/RouterListener.php line 135 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"POST http://example.com/api/webhooks/telegram\" at /var/www/app/public_html/vendor/symfony/http-kernel/EventListener/RouterListener.php:135)\n[previous exception] [object] (Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): No routes found for \"/api/webhooks/telegram\". at /var/www/app/public_html/vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherTrait.php:74)"} []

May be I have missed something? Some Webhook/Bot/Telegram setting?

I thought that webhook should trigger my API that i have passed for it. But unfotunatly he decided to trigger it by http:// protocol, insted https://

And I have no idea how to solve it

0

There are 0 answers