Why can't App Web Pixels make fetch requests to the same origin as the shop (eg via app proxy)?

Why can't App Web Pixels make fetch requests to the same origin as the shop (eg via app proxy)?

calvin_proteus
Shopify Partner
2 0 0

As the title states, a web pixel attempting to make fetch requests to the same origin is hit with this error:

 

RestrictedUrlError: Requests are not allowed to the same origin: 

This is especially brutal because it means that web pixels cannot communicate to the backend via app proxies. Why does this limitation exist? Is it documented anywhere? 

 

Even more confusing, the documentation About web pixels mentions:

 

fetch  and related globals (Headers , Request , and Response ), which can be used to make HTTP requests to arbitrary endpoints. Note: Any requests you make must explicitly support cross-origin resource sharing (CORS) , just as they would if the request were coming from fetch() outside of a web worker.

I would assume that app proxies would be included in the category of "arbitrary endpoints".

 

Any help would be much appreciated.

Replies 0 (0)