Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4849

Redirect POST data api http to https

$
0
0

@baonq wrote:

My Server not connect to internet and I can’t use api telegram for alert notification.
I have a HAProxy server and I want it to be an api proxy.
But I can’t redirect request to api.telegram.org
My HAProxy config:

frontend http_vip_6_199
bind 192.168.6.199:80
mode http

    capture request header Host len 128
    capture request header User-Agent len 256
    capture request  header Referer len 128

    option forwardfor
    option http-server-close
    option http-keep-alive
    timeout http-keep-alive 3000
    timeout http-request  5000

use_backend api_telegram if { hdr(host) -i api.telegram.org }
redirect scheme https if !{ ssl_fc } { hdr(host) -i api.telegram.org }
backend api_telegram
mode http
server test api.telegram.org:443

and myscript sent telegram msg
curl -i -L
-H “Host: api.telegram.org
-d “chat_id={TELEGRAM_CHAT_ID}" \ -d "text={MESSAGE}”
-d “parse_mode=HTML”
-d “disable_web_page_preview=true”
http://192.168.6.199/bot${TELEGRAM_BOT_TOKEN}/sendMessage

HTTP/1.1 400 Bad Request
Server: nginx/1.16.1
Date: Thu, 27 Feb 2020 02:02:39 GMT
Content-Type: application/json
Content-Length: 80
Connection: keep-alive
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Content-Length,Content-Type,Date,Server,Connection

{“ok”:false,“error_code”:400,“description”:“Bad Request: message text is empty”}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4849

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>