vite-plugin-cross-origin-isolation icon indicating copy to clipboard operation
vite-plugin-cross-origin-isolation copied to clipboard

This can now be supported through the `server.headers` option

Open chaosprint opened this issue 2 years ago • 1 comments

Unfortunately, there is zero doc about server.headers on the official website. Interesting. The issue is closed, but you can still find some useful info there: https://github.com/vitejs/vite/issues/3909

chaosprint avatar Apr 13 '22 11:04 chaosprint

server.headers seems to be documented now. https://vitejs.dev/config/#server-headers

Now we can write vite.config.ts like the bellow.

import { defineConfig } from "vite";

export default defineConfig({
  server: {
    headers: {
      "Cross-Origin-Embedder-Policy": "require-corp",
      "Cross-Origin-Opener-Policy": "same-origin",
    },
  },
});

reosablo avatar May 15 '22 07:05 reosablo