Answer the question
In order to leave comments, you need to log in
Why does the telegram bot work on local, but not on the server?
Hello!
I wrote a telegram bot on telegraf.js, tested it locally with ngrok, everything works fine. I bought a VPS, raised a server to nginx + set up the node certificates, I'm running it. BUT! getWebhookInfo throws an error: Wrong response from the webhook: 502 Bad Gateway .
Checked the error.log:
Error: upstream prematurely closed connection while reading response header from upstream
The node is closing the connection prematurely. Shoveled everything I could, but the error is the same.
nginx/sites-available/default config:
server {
listen 443 ssl;
ssl_certificate /path/to/cert.crt;
ssl_certificate_key /path/to/cert_key.key;
server_name infocardbot.dreamcode.kz;
location /hook {
proxy_connect_timeout 90s;
proxy_send_timeout 120s;
proxy_read_timeout 120s;
proxy_pass http://127.0.0.1:4000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question