Twilio · api · fg-0167

validateRequest returns false behind a proxy, tunnel or load balancer although the Auth Token is right

If you see Signature check passes locally but fails for every request in production, the cause and the fix for Twilio are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
Signature check passes locally but fails for every request in productionWebhook starts returning 403 after moving behind TLS terminationJSON webhooks never validate when passed as parameters
Cause
Twilio signs the exact public URL it called, including scheme, port and query string, plus the sorted POST parameters. An app that rebuilds the URL from its internal host or http scheme computes a different string; voice callbacks over HTTPS also drop the port, and JSON bodies are covered by a bodySHA256 query parameter instead.
Fix
Build the validation URL from your configured public base URL, not from the incoming Host header. For application/json requests use validateRequestWithBody with the raw body.
Apply
const url = 'https://api.example.com' + req.originalUrl; // public URL Twilio called const ok = twilio.validateRequest(process.env.TWILIO_AUTH_TOKEN, req.header('X-Twilio-Signature'), url, req.body); // JSON body: twilio.validateRequestWithBody(token, signature, url, rawBodyString)
Affected
Twilio webhook signature validation for SMS, Voice and Conversations, checked October 2026
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun