-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Support Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy on dev server #3909
Comments
Well, I build this plugin. It works for my purpose but may require further testing. |
Worked for me. Awesome lib. Thanks! |
Any headers should be configured like in serve https://github.com/vercel/serve-handler#headers-array |
Thanks for the info. I know that Firebase or Netlify all have own ways to set it, but in this issue thread I am referring to the vitejs local dev server. This header settings should become default for testing SAB locally. |
@chaosprint thank you for reply. I developing frontpage for our wasm lib in vite and it require special headers for it. I I suppose it should be in core for wasm supporting. Wasm become more popular |
To add custom headers, you can add the following snippet inline to the
|
Going off of what @ssc-hrep3 here's what I have now in my import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
{
name: "configure-response-headers",
configureServer: (server) => {
server.middlewares.use((_req, res, next) => {
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
next();
});
},
},
],
}); |
This works for the vite dev server but how to you enable this for |
This can now be supported through the |
Clear and concise description of the problem
Cross-Origin-Opener-Policy
andCross-Origin-Embedder-Policy
headers are necessary to supportSharedArrayBuffer
, as is explained in this article.But so far, on Vite.js website and docs, there is no description of that, which would be a pain.
Here (https://vitejs.dev/config/#server-https) in docs, no examples are given.
Usually in node.js it is set like this:
But it seems that in vite there is no way to do it?
The text was updated successfully, but these errors were encountered: