ServiceNow MID Server 403 on GC Webhook Signature Validation despite correct Secret Key

Stuck on a problem and need help troubleshooting a persistent 403 Forbidden error when Genesys Cloud tries to push digital channel messaging session data to our ServiceNow instance via the MID Server.

we have a Data Action configured to trigger on messaging:session:start and messaging:session:end events. the payload is being sent to the ServiceNow REST API endpoint (/api/now/table/incident) through the MID Server proxy. the issue is specifically with the signature validation header (X-GC-Signature).

the error log in the ServiceNow syslog shows:

ERROR: Webhook signature verification failed. Expected signature does not match calculated signature. Rejecting request.

i have triple-checked the secret key used in the Genesys Cloud webhook configuration against the one stored in the ServiceNow glide.webhook.secret property. they match character for character. the timestamp in the header is within the 5-minute window. the body hash is calculated using SHA256 as per the docs.

here is the weird part. if i use a simple curl command from a local machine (bypassing the MID Server) with the exact same payload and headers, ServiceNow accepts it. but when the request comes through the MID Server, it fails.

is the MID Server modifying the payload body or headers in transit? i noticed the Content-Type header changes from application/json to application/json; charset=utf-8 sometimes. could that affect the signature calculation?

also, the Genesys Cloud EU-West region is used, and the MID Server is in Madrid (v2.3). latency is low, but maybe there’s a timezone drift issue with the timestamp validation? the server time is synced via NTP.

has anyone seen this specific signature mismatch only when using the MID Server? i’ve tried disabling the signature validation in ServiceNow for testing (not recommended obviously) and the ticket gets created fine, which confirms the payload structure and API permissions are correct. so it’s purely a signature mismatch.

any insights on how the MID Server handles the raw body for signature verification? i’m stuck on this for two days. thanks.