I'm developing a website in React using create-react-app. I'm using an external script for some features relating to credit card payment (Clover in this case). This script adds iframes to the page which themselves load some additional resources from the same domain such as other scripts and stylesheets. This all works fine. However in development when this script attempts to create a token to process payment, it calls another subdomain and I get the following error:
Access to fetch at 'https://token-sandbox.dev.clover.com/v1/tokens' from origin 'https://checkout.sandbox.dev.clover.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I tried proxying the first script using http-proxy-middleware but then all the loading of additional resources are relative and fail since they now point to localhost.