One of the recent measures proposed by our team to reduce the impact of wrong messaging URL is to implement something that comes from CloudEvent specification.
https://github.com/cloudevents/spec/blob/v1.0-rc1/http-webhook.md#421-webhook-allowed-origin 4.1.2. WebHook-Request-Origin
It is to perform a validation handshake and it is used for an abuse protection.
The webhook endpoint needs to implement the OPTIONS http method and return a header with Webhook-Allowed-Origin: eventemitter.example.com If and only if the delivery target does allow delivery of the events, it MUST reply to the request by including the WebHook-Allowed-Origin.
I am new to this world. By any chance, can anyone please provide sample related code having OPTIONS http method. I could find only following rest annotations in https://resources.docs.salesforce.com/224/latest/en-us/sfdc/pdf/api_rest.pdf -
@RestResource(urlMapping='/yourUrl') @HttpDelete @HttpGet @HttpPatch @HttpPost @HttpPut
I am looking for something like @HttpOptions (may be i am wrong in this assumption). Any pointers will be of great help.