Do you deploy just the JS to a CDN or a whole website? I wanted to do something similar, throw a static website on a CDN and use a Go API as its backend. But unsure how to get around CORS in a reliable way.
You whitelist domains that can access your server (in my case I have env vars with whitelisted domains list that the Go code picks up) and that should be all you need to do.