http-proxy icon indicating copy to clipboard operation
http-proxy copied to clipboard

Using with Discord webhooks

Open Corfucinas opened this issue 3 years ago • 5 comments

Is it possible to use this server to send POST requests to discord webhooks?

I recently tried using the following URL http://localhost:3000/api/webhooks/my_webhook, this is replacing https://discord.com/api/webhooks/my_webhook with http://localhost:3000 as the base.

The post request failed, and this is the log from the server

2022-08-15T04:33:41.681536Z  INFO twilight_http_proxy: Listening on http://0.0.0.0:3000
2022-08-15T04:33:51.290020Z ERROR twilight_http_proxy: Error when requesting the Discord API: hyper::Error(Connect, ConnectError("dns error", ResolveError { kind: Proto(ProtoError { kind: Io(Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }) }) }))

this is the response by the http_client

Response: Method - POST Url - http://localhost:3000/api/webhooks/my_webhool - Status 502 - Headers - Headers({'content-length': '44', 'date': 'Mon, 15 Aug 2022 04:33:51 GMT'})

I'm processing a queue of messages where each message contains a Discord Webook for its destination (these webhooks are from different accounts that are not owned by myself.)

Corfucinas avatar Aug 15 '22 04:08 Corfucinas

I have the same use case and can confirm I am experiencing the same issue as well. 502 responses happens for most of the requests with a webhook.

PredaaA avatar Jul 29 '23 01:07 PredaaA

does this happen only with some webhook executions or all of them?

laralove143 avatar Jul 29 '23 02:07 laralove143

Not all of them, it seems to be happening randomly.

PredaaA avatar Jul 29 '23 16:07 PredaaA

thats odd, do you have debug tracing enabled? it'd be useful to see if this is happening with a pattern of requests

laralove143 avatar Jul 29 '23 18:07 laralove143

I don't, but I will turn it on and let you know what I get from it.

PredaaA avatar Jul 29 '23 21:07 PredaaA