@abi-software/simulationvuer 3.2.6 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -52,6 +52,47 @@ where:
52
52
 
53
53
  Note that a simulation will be run on oSPARC if the `id` references a SPARC simulation-based dataset, in a user's browser otherwise.
54
54
 
55
+ ## Deployment
56
+
57
+ SimulationVuer uses [@opencor/opencor](https://www.npmjs.com/package/@opencor/opencor), which relies on [libOpenCOR](https://github.com/opencor/libopencor)'s threaded WebAssembly (WASM) to run simulations in the browser. Threaded WASM requires [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), which in turn requires the page to be served with **cross-origin isolation** headers.
58
+
59
+ When deploying an application that uses SimulationVuer, your Web server **must** must send the following headers with the HTML document:
60
+
61
+ ```http
62
+ Cross-Origin-Opener-Policy: same-origin
63
+ Cross-Origin-Embedder-Policy: require-corp
64
+ ```
65
+
66
+ Without these headers, @opencor/opencor will fail to initialise libOpenCOR and will not function.
67
+
68
+ The exact steps to set these headers depend on your Web server. Here are the steps for Apache:
69
+
70
+ 1. **Enable `mod_headers`**. Ensure the `headers` module is enabled (e.g., `a2enmod headers` or add it to your modules list).
71
+ 2. **Set headers on the HTML path**. In your virtual host config, add:
72
+
73
+ ```apache
74
+ <Location "/app">
75
+ Header set Cross-Origin-Opener-Policy "same-origin"
76
+ Header set Cross-Origin-Embedder-Policy "require-corp"
77
+ </Location>
78
+ ```
79
+
80
+ Adjust the `Location` path to match the URL prefix where the Web app is served (here, we use `/app` assuming the Web app is served from `https://your-domain.com/app`).
81
+
82
+ 3. **Reload Apache**. Apply the changes with `sudo apachectl reload` or the equivalent for your distribution.
83
+ 4. **Verify**. Check the response headers on your deployed HTML page using:
84
+
85
+ ```bash
86
+ curl -I https://your-domain.com/app/
87
+ ```
88
+
89
+ You should see:
90
+
91
+ ```http
92
+ cross-origin-opener-policy: same-origin
93
+ cross-origin-embedder-policy: require-corp
94
+ ```
95
+
55
96
  ## Project setup
56
97
 
57
98
  ### Clone the respository