Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For the Docu: Vite and CORS #41

Closed
rowild opened this issue Nov 6, 2023 · 3 comments
Closed

For the Docu: Vite and CORS #41

rowild opened this issue Nov 6, 2023 · 3 comments

Comments

@rowild
Copy link

rowild commented Nov 6, 2023

In case somebody uses Vite: Vite seems to require some special CORS configuration to be able to read SharedBufferArray. A solution would be this:
chaosprint/vite-plugin-cross-origin-isolation#3
or this vite plugin:
https://github.com/chaosprint/vite-plugin-cross-origin-isolation

@guyettinger
Copy link

If you don't have the ability to configure cross origin isolation on the server (i.e. github pages), you can also use a coi-serviceworker in your webpage:

<script src="coi-serviceworker.js"></script>

@mkkellogg
Copy link
Owner

I'm going to close this issue, but I will add this info to the README.

@MengtianWen
Copy link

If you need to deploy your project to a server via Nginx, you can also achieve cross-origin isolation via Nginx configuration:

server {
  listen       80;
  listen  [::]:80;
  server_name  localhost;

  location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;

    add_header 'Cross-Origin-Embedder-Policy' 'require-corp';
    add_header 'Cross-Origin-Opener-Policy' 'same-origin';	 
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants