analytics-next
analytics-next copied to clipboard
Make HTTP headers configurable
We want to use our backend as a proxy to Segment API in order to bypass ad-blockers. We have CSRF protection in place so all requests to our endpoints need to contain X-CSRF-TOKEN header. But @segment/analytics-next library doesn't enable us to set custom HTTP headers.
It looks like headers are hardcoded in fetch-dispatcher and it's been like in a predecessor of this library (see https://github.com/segmentio/analytics.js-integrations/issues/560).
Can you add a new configuration property which will allow us to append additional HTTP headers? Other people are asking for it as well, see https://github.com/segmentio/analytics-next/issues/312#issuecomment-971202650.