CORS

Why curl works but browser JavaScript may fail.

A curl request can reach a webhook directly because it is not running inside a visitor's browser. Browser JavaScript has extra cross-site safety checks.

The common fix

If direct browser JavaScript fails but curl works, send the browser request to your own website first, such as /api/contact. Your website server can then forward the alert to a redacted PINGSLAP webhook URL like https://api.pingslap.com/webhook/REDACTED.

Visitor's browserPOST /api/contact on the same websiteWebsite server or reverse proxyPINGSLAP webhook

Why curl worked

curl sends the request from your machine or server. It is not a web page loaded from another domain, so browser CORS rules are not involved.

Why browser JavaScript failed

A page at https://www.example.com calling https://api.example-service.test is cross-origin. The browser checks whether that receiving server allows the page to call it.

Why /api/contact helped

The browser posts to the same website it is already visiting. That is same-origin. The website server receives the form data and forwards only the safe alert fields to PINGSLAP.

What CORS does not control

Browser CORS rules do not govern the server-to-server forwarding request from your website server or reverse proxy to PINGSLAP.