Godot Engine game hosting?

I’m trying out the latest Godot Engine 4.x beta and exported my project to the web. However I get an error when I try to run from the generic HTML / CSS / JS template. Does anyone have any ideas how I could either configure it correctly, or set up a proper server to send the right headers?

Repo:
https://replit.com/@triptych/Godot-40-b8-web-test#replit.nix

Error message
chrome_nlRitbkrLu

You can’t set headers without a server-side language. To fix this, I used NodeJS (with Express). I set the required headers to enable cross origin isolation before any content was delivered.

The NodeJS server looks like this:
index.js

// this sets up the server
const express = require("express");
const app = express();
const server = require("http").createServer(app);
const port = process.env.PORT || 3000;

// this adds the required headers to the response
app.use(function(req, res, next) {
	res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
	res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
	next();
});

// this hosts all the files in the 'public' folder (you should put all the files in your original HTML, CSS, and JS Repl in a folder named "public", you can change the name of the folder hosted by changing the name below)
app.use(express.static("public"));

// this starts the server
server.listen(port, function() {
	console.log("Listening on port:", port);
});

Then you should have a folder named public where you put in all the files (that are required, no need for the .replit, replit.nix files etc) in your original HTML, CSS, and JS Repl.

This Repl is a working version of your Godot Engine game (although it seems it only works when opened in a new tab, not in the webview).

Edit: It cannot work in the webview because the parent page has different headers set and the Repl is running in an iframe. You will always have to open it in a new tab.

Thanks so much! I will try this out today.