Skip to content

Headers are not send #22235

@solodeveloping

Description

@solodeveloping

Describe the bug

I'm working an a browser extension, I'm using Vue + Vite for the web pages.

I needed to use OPFS, so I had to set Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy.

I added this to the server, and it used to work.

It seems like it's not working anymore, the html file has it but other files don't.

I've checked this, but I'm not using preview #9864

I haven't seen any indication in the doc that the headers should not be always send, the doc is sparse though:

Image

I have this config:

// in the plugins:
    {
      name: 'set-headers',
      configurePreviewServer(server) {
        server.middlewares.use((req, res, next) => {
          res.setHeader("Cross-Origin-Opener-Policy", "same-origin")
          res.setHeader("Cross-Origin-Embedder-Policy", "require-corp")
          next()
        })
      }
    }
  ],
  // WARN : necessary for wasm SQLite
  server: {
    headers: {
      'Cross-Origin-Opener-Policy': 'same-origin',
      'Cross-Origin-Embedder-Policy': 'require-corp',
    },
    watch: {
      ignored: [
        // "./src/options/worker.ts",
        // "./src/options/worker.js"
      ],
    },
  },
  optimizeDeps: {
    include: [
      'vue',
      '@vueuse/core',
      'webextension-polyfill',
    ],
    exclude: [
      'vue-demi',
      '@sqlite.org/sqlite-wasm',
      'quickjs-emscripten'
    ],
  },

Since then, I've updated a few files because I thought the error was from SQLite but it seems it was not.

Reproduction

https://codeberg.org/SoloDeveloping/SemanticNotes

Steps to reproduce

Run pnpm install, pnpm dev, install the extension, open the sidepanel, open the main extension url, and it does not seem to be working anymore.

System Info

System:
    OS: Windows 10 10.0.19045

Browsers:
    Chrome: 147.0.7727.56

Brave 1.89.132 (Build officiel) (64 bits)
Chromium: 147.0.7727.56

Tested on Chrome and Brave.

Used Package Manager

pnpm

Logs

It's present on the html file:

Image

Not present in the main ts file:

Image

Not present in the SQLite file, but requested:

Image

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions