K
K
k_f_i2022-01-06 21:58:34
Python
k_f_i, 2022-01-06 21:58:34

How to properly set up Webhook on the server?

Hello everyone, for the first time I am doing a Webhook for a telegram bot, articles on this topic helped, but I ran into such a problem. When run on a local machine using ngrok, everything works fine, below is an example of configurations.

# Webhook setting
WEBHOOK_HOST = ''
WEBHOOK_PATH = ''
WEBHOOK_URL = f' https://f00000000000.ngrok.io '
# webserver sitting
WEBAPP_HOST = '127.0.0.1'
WEBAPP_PORT = 80

When running on the server, nothing works.

# Webhook setting
WEBHOOK_HOST = ''
WEBHOOK_PATH = ''
WEBHOOK_URL = f' https://11.111.11.1 '
# webserver sitting
WEBAPP_HOST = '11.111.11.1'

I understand that the problem is in the server settings, as well as certificates, but I can not find a solution.
Here is what the console outputs.

messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"
INFO:aiohttp.access:11.11.11.1 [06/Jan/2022:18:42:02 +0000] "UNKNOWN / HTTP/1.0" 400 204 "-" "-"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2022-01-06
@ky0

Well, there, in the last line everything is perfectly described. You send an HTTP request without specifying a method - any normal web server will, of course, respond with an error to this.
Perhaps, in addition, the processing of requests by IP address is somehow incorrectly configured on your server. Also, your software may be expecting a valid certificate (which can be obtained for a domain name, not "11.11.11.1").

A
Alexander Karabanov, 2022-01-07
@karabanov

Register a free domain at freenom.com or use the technical domain provided by the host.
Issue a full certificate with Let's encrypt

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question