Custom Web Pixel Fetch Sending Origin: null

Topic summary

Developers are experiencing an issue where Shopify’s custom web pixel sends Origin: null in request headers, causing CORS complications.

Key Details:

  • The problem occurs when following Shopify’s official documentation for custom web pixels
  • Origin: null is set by the browser and cannot be modified by client code
  • This represents new behavior from Shopify that wasn’t present previously
  • One developer mentions working around it by setting origin: true on their server, which echoes back the received origin in the Access-Control-Allow-Origin header

Potential Solutions Mentioned:

  • Using window.postMessage() was suggested based on non-Shopify forums, though implementation details remain unclear

Current Status:

  • Multiple developers have confirmed experiencing the same issue
  • No official solution or response has been provided
  • The discussion remains open with participants seeking updates and assistance
Summarized with AI on November 1. AI used: claude-sonnet-4-5-20250929.

Hey Shopify Devs and Support,

We are having an issue with our custom web pixel sending origin: null in the request headers. We are following the exact example from the docs here. Below is a screenshot of our custom web pixel, its log to the console, and the DevTools details for that request. Notice Null being sent by the requesting resource. This is what my server looks like. Origin is set by the browser, its not something that can be set by the client code. As you can see the reason this request does not fail CORS is because i have origin: true in my server. This essentially just repeats back the origin it received in the Access-Control-Allow-Origin header.

Shopify sending Origin: null is new behavior and was not like this before. If anyone has some context on this or a solution to fix this, I would be greatly appreciative.

Screenshot 2023-11-01 at 8.27.59 AM.png

5 Likes

Also looking for a solution here

1 Like

Receiving the same error. I have seen in some non-Shopify forums that window.postMessage() may be a solution, but I am not sure if or how that can be implemented here. Is anyone able to assist?

2 Likes

Same issue here, any updates on this?

We are also facing the same error, is there any updates on this?