Ever since TradingView opened up their webhook support, I've been pulling out my hair trying to figure out why no signals are being received by my server. I've done the following so far:
- Made sure ports were open, made sure TradingView was actually sending the POST requests
- Tried POSTing on a barebones nodejs server, flask server, and finally a nginx reverse proxy to the flask server.
- Cross-referenced the incoming POST headers and body on webhook.site, replicated it on Postman as well as other tools and my server received them fine
You can see the signals coming in live here: http://webhook.site/#!/48e29a5b-d266-4021-8b96-0039371b3643/2005d010-e3ae-4077-8808-af34491f5a4d/
But somewhere along the delivery something is obviously going wrong because there is not even a trace of any requests in the nginx logs and the unix logs. It's definitely not a firewall or CORS issue, or I would have the same problem when replicating with tools, right? Can anyone out there help me crack this case?
Here's my nginx config:
server {
listen 80;
server_name lunarlabs.org;
location / {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name lunarlabs.org;
ssl_certificate /etc/letsencrypt/live/***.org/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/***.org/privkey.pem;
# ...
access_log /var/log/nginx.log;
error_log /var/log/nginxerror.log;
root /var/www/html/public;
index index.php;
location / {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,X-Forwarded-For,content-length';
include proxy_params;
proxy_pass http://unix:/home/tvhook/***;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
The demo webhook server I have set up can be reached at https://lunarlabs.org/webhook -- any JSON formatted POST data should return a 200. But TradingView's signals, it appears, really doesn't like my server or my server really doesn't like their request.