I've written an app with the new Godot 4 environment and am now trying to deploy it on an Apache web server. I'm getting an error saying I need to set up some headers, but am unsure what headers I have to set or how to get Apache web server to serve them. This isn't for itch.io - this is a server I have the ability to configure.

Error
The following features required to run Godot projects on the Web are missing:
Cross Origin Isolation - Check web server configuration (send correct headers)
SharedArrayBuffer - Check web server configuration (send correct headers)

Cross Origin Isolation requires CORS
https://ubiq.co/tech-blog/enable-cors-apache-web-server/
https://web.dev/cross-origin-isolation-guide/

Getting that resolved might already be enough to resolve the Shared Array issue too, though apparently certain browsers might be configured by default to have it disabled:
https://techkblog.com/enable-sharedarraybuffer-coop-coep/
https://blog.stackblitz.com/posts/cross-browser-with-coop-coep/

6 months later
2 months later

Luking I have successfully hosted an apache server on localhost with CORS enabled and it works. However when i try to connect to the server from other device in the same network, it shows the exact same error with CORS disabled.

I have opened the port and set the "Header add Access-Control-Allow-Origin "*"" to all interfaces.

I haven't found the solution anywhere in the internet. I wonder if it's the problem with godot itself or the server? I tried to do the same with python module http.server, but didn't get anywhere.

Do u have any idea how to fix that?

6 days later
    <Directory /srv/www/mygame/>
        Require all granted
        Header set Cross-Origin-Opener-Policy "same-origin"
        Header set Cross-Origin-Embedder-Policy "require-corp"
    </Directory>

worked for me with Apache 2.4