idbrii
idbrii

Reputation: 11946

Fix "SharedArrayBuffer is not defined" on local http.server

I use python3 -m http.server --bind localhost to quickly host local versions of web content for testing.

I was using this to host a web version of a game I was working on and ran into this error:

Uncaught ReferenceError: SharedArrayBuffer is not defined

The engine I'm using has advice for this error:

Enable the following HTML response headers on the website you're hosting your project on:

  • Cross-Origin-Opener-Policy: same-origin
  • Cross-Origin-Embedder-Policy: require-corp

But I don't understand how to set these headers. Do I need to implement my own subclass of BaseHTTPRequestHandler (and how)? Or do I call send_header on... something?

Upvotes: 2

Views: 920

Answers (0)

Related Questions