Closed rocheston closed 5 months ago
The most likely issue is that you need to send the same HTTP headers that the Cloudflare Worker does: https://github.com/mihaip/infinite-mac/blob/5b84d895b0b661a6027c655f434f36d046309fdf/workers-site/index.ts#L79-L90
(the most important ones being Cross-Origin-Opener-Policy
, Cross-Origin-Embedder-Policy
, and Service-Worker-Allowed
).
The emulator runs in a worker and it needs SharedArrayBuffer
to communicate efficiently with the main browser process. That needs the Cross-Origin-Opener-Policy
and Cross-Origin-Embedder-Policy
headers (see this page for an explanation).
As a fallback, if SharedArrayBuffer
is not available (it was disabled in Safari for quite a while), I came up with a workaround that uses service worker request interception.
Note that both SharedArrayBuffer
and service workers need HTTPS if served from non-localhost
domains.
I'm grateful for your solution. This has been successfully incorporated into the Apache2 virtual host and it works flawlessly. All errors have been eliminated. My sincere thanks once again.🙏
Great!
I deployed the application by running 'npm run build' and served the resulting build directory using Apache2. However, when I make attempts to run the page in a web browser, it throws a lot of errors. One recurring message I'm seeing in the browser console indicates that 'service worker is not available.
I should note that my intention is not to publish on Cloudflare Wrangler, but instead on a dedicated Apache web server. Could you provide some help with this problem?