CORS failure on Next.js Messenger embed

Embedding the CXone Messenger in a Next.js app hits CORS blocks on the guest API. The widget loads but fails to authenticate because the fetch requests originate from the client and get rejected by the proxy. Has anyone solved this with a middleware rewrite?