Should Webhooks originating from particle include an "Origin" header?

Building a Webhook integration for a 3rd-party solution (Telegraf).

Following along with samples and learning as I go, I built a solution that worked under tests but did not work when using a live particle integration. Diagnosing, it appears the absence of an Origin header in the webhook call from particle is the problem.

I added a user-defined Origin header in my Integration and my code works.

It’s unclear from my research whether a CORS request (non-JSON) ought to include the Origin.

Hm – @jeiden @rickkas7 any thoughts?

To be honest, I can’t quite see the use case where you need CORS on a webhook. However, I don’t doubt that there are cases where CORS would be necessary, and, then, yes, you would probably need to manually add an Origin header. Basically, any time you need CORS you’ll need an Origin header, and there’s no way for the webhook server to add one automatically, since I don’t think it would have any idea of what it would need to be set to.

Thank you for the prompt reply.

You are right. I’m confident I am wrong.

I’ve built a very simple Telegraf WebHooks plugin. I can register Integrations against the Telegraf WebHooks, the events are captured and poured into InfluxDB from where I can visualize them in Grafana.

It’s a project for my curiosity and combines my interests in particle.io, golang, Telegraf|InfluxDB and (everything’s deployed in) containers. But, it works (mostly – needs some InfluxDB tweaks) and I can graph particle events.

I got myself down a rabbit-hole trying to debug my WebHooks implementation. I used RequestBin and PutsReq as test WebHook endpoints for the particle Integration but then needed a WebHooks client to test my WebHooks server|plugin.

The sample code I used as a template for the plugin expects an additional header. I wrote the client using JavaScript and then scoped my searches to AJAX and WebHooks and the results from my searches, AJAX, headers etc. led me to CORS being required. It’s not. I’m going to unwind this code and prove this to myself.

Apologies for wasting your time!