Skip to content

Commit

Permalink
Add details about deploying with CORS (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter authored Dec 19, 2024
1 parent 12a9bd5 commit d4bf6a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion demos/web-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,17 @@ npm run serve
Or bundle files for distribution with

```
npm run build
npm run dist
```

The web application must be served with cross-origin isolation, because it uses
[shared memory](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements)
for multithreading.

The demo server is configured to add those headers in `serve.json`.

To serve the application with Apache, add the following to an `.htaccess` file:
```
Header add Cross-Origin-Embedder-Policy: "require-corp"
Header add Cross-Origin-Opener-Policy: "same-origin"
```
2 changes: 1 addition & 1 deletion demos/web-editor/web/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class App {

const endTime = performance.now();
document.getElementById("status").textContent =
`Rendered in ${endTime - this.start_time} ms`;
`Rendered in ${(endTime - this.start_time).toFixed(2)} ms`;
break;
}
case ResponseKind.Script: {
Expand Down

0 comments on commit d4bf6a9

Please sign in to comment.