Skip to content

Commit

Permalink
Serve the Origin-Agent-Cluster: ?1 header through .htaccess instead o…
Browse files Browse the repository at this point in the history
…f a iframe-worker.php file
  • Loading branch information
adamziel committed Oct 14, 2022
1 parent 5f03281 commit 294dcb3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
5 changes: 2 additions & 3 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ if (argv.platform === "browser") {
let wasmWorkerUrl;
if (wasmWorkerBackend === 'iframe') {
const wasmWorkerOrigin = process.env.WASM_WORKER_ORIGIN || 'http://127.0.0.1:8778';
const wasmWorkerFilename = process.env.WASM_WORKER_FILENAME || 'iframe-worker.html';
wasmWorkerUrl = `${wasmWorkerOrigin}/${wasmWorkerFilename}`;
wasmWorkerUrl = `${wasmWorkerOrigin}/iframe-worker.html`;
} else {
wasmWorkerUrl = `${serviceWorkerOrigin}/wasm-worker.js`;
}

options = {
...defaults,
entryPoints: {
Expand Down
6 changes: 5 additions & 1 deletion dist-web/.htaccess
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
AddType application/wasm .wasm

RewriteEngine on
RewriteRule ^scope:.*?/(.*)$ $1
RewriteRule ^scope:.*?/(.*)$ $1

<FilesMatch "iframe-worker.html$">
Header set Origin-Agent-Cluster: ?1
</FilesMatch>
7 changes: 0 additions & 7 deletions dist-web/iframe-worker.php

This file was deleted.

8 changes: 7 additions & 1 deletion liveServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,11 @@ liveServer.start({
liveServer.start({
port: 8778,
root: __dirname + '/dist-web',
open: false
open: false,
middleware: [
(req, res, next) => {
res.setHeader('Origin-Agent-Cluster', '?1');
next();
},
],
});

0 comments on commit 294dcb3

Please sign in to comment.