Hi, It seems I’m the only one having this problem
(I hope not ).
I’m trying to register a new webhook with this URL: https://api.twitter.com/1.1/account_activity/all/:env_name/webhooks.json
I’ve made a POST to this URL and I made sure I passed the Webhook URL as an encoded parameter.
The problem is that I get a “502 Bad Gateway” Error when twitter calls the WebHook, I’m using Ngrok locally so I was able to replay the request. When I replay the request, I don’t get the error and the code works as expected.
It also works If I access it through the browser.
I thought this was a problem with Ngrok, so I decided to switch to serveo (http://serveo.net/) I got the same 502 Bad Gateway.
I decided to finally take the bull by the horn and use Nginx directly on my production server and I’m still getting “502 Bad Gateway”
Like I said earlier, If I access my webhook URL through the browser everything works.
I’m starting to think there’s a problem with the way twitter calls my WebHook (Because I’ve tried three options and they all behave the same way.)
I’ve inspected the Nginx log and I noticed that twitter doesn’t send a “User-Agent” header (It’s blank)
199.16.157.173 - - [13/Oct/2018:11:43:37 +0000] "GET /twitter/webhooks?crc_token=xxxxxxxxxx&nonce=MTUzOTQzMTAxNzI1Ng HTTP/1.1" 502 182 "-" "-"
could that be the problem?
By the way, I’m using Go (Maybe twitter doesn’t like Go
) But I can confirm that the API call from twitter doesn’t reach the application, It’s automatically rejected by the Proxy server (Ngrok, serveo or Nginx). I don’t know why.
If anyone uses Nginx as their proxy server, Please I’d love to see your configuration