Skip to content

allowedHosts should support chrome-extension:// #3807

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

Closed
1 task done
montogeek opened this issue Sep 7, 2021 · 3 comments · Fixed by #3822
Closed
1 task done

allowedHosts should support chrome-extension:// #3807

montogeek opened this issue Sep 7, 2021 · 3 comments · Fixed by #3822
Assignees

Comments

@montogeek
Copy link
Member

montogeek commented Sep 7, 2021

  • This is a modification request

Code

// webpack.config.js
// Configuring webpack-dev-server through https://nx.dev
config.devServer.allowedHosts.push('example.com');
config.devServer.allowedHosts.push("chrome-extension://*") // Does not work.

Please paste the results of npx webpack-cli info here, and mention other relevant information

System:
    OS: macOS 11.5.1
    CPU: (8) x64 Apple M1
    Memory: 255.45 MB / 16.00 GB
  Binaries:
    Node: 14.17.3 - ~/.volta/tools/image/node/14.17.3/bin/node
    Yarn: 3.0.1 - ~/.volta/tools/image/yarn/1.22.11/bin/yarn
    npm: 6.14.13 - ~/.volta/tools/image/node/14.17.3/bin/npm
  Browsers:
    Brave Browser: 93.1.29.77
    Chrome: 93.0.4577.63
    Edge: 93.0.961.38
    Firefox: 91.0.1
    Safari: 14.1.2
  Monorepos:
    Yarn Workspaces: 3.0.1
  Packages:
    webpack: 4.46.0
    webpack-dev-server: 3.11.2

Nx.dev report

❯ yarn nx report                                                                                                                                                                                                           ─╯
yarn run v1.22.11
$ nx report

>  NX  Report complete - copy this into the issue template

  Node : 14.17.3
  OS   : darwin x64
  yarn : 1.22.11

  nx : Not Found
  @nrwl/angular : Not Found
  @nrwl/cli : 12.7.2
  @nrwl/cypress : 12.7.2
  @nrwl/devkit : 12.7.2
  @nrwl/eslint-plugin-nx : 12.7.2
  @nrwl/express : Not Found
  @nrwl/jest : 12.7.2
  @nrwl/linter : 12.7.2
  @nrwl/nest : Not Found
  @nrwl/next : 12.7.2
  @nrwl/node : Not Found
  @nrwl/nx-cloud : Not Found
  @nrwl/react : 12.7.2
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.7.2
  @nrwl/web : 12.7.2
  @nrwl/workspace : 12.7.2
  @nrwl/storybook : 12.8.0
  @nrwl/gatsby : Not Found
  typescript : 4.3.5

✨  Done in 0.91s.

Expected Behavior

allowedHosts should support other protocols different than http(s).

Actual Behavior

allowedHosts does not support other protocols different than http(s).

For Features; What is the motivation and/or use-case for the feature?

Google created a new version of its extensions, it is called Manifest V3 https://developer.chrome.com/docs/extensions/mv3/intro/mv3-migration/
In that change, background pages, which used to be normal browser scripts, are now Service Workers, so its Origin is now chrome-extension://{id}

This is how a request looks like now:

curl 'wss://my-project.dev.local:4200/sockjs-node/992/x2kd5s00/websocket' \
  -H 'Pragma: no-cache' \
  -H 'Origin: chrome-extension://goibgnocilnihbfimnmnhcbegglbopgj' \
  -H 'Accept-Language: en,de;q=0.9' \
  -H 'Sec-WebSocket-Key: k+jDKTZeXjouu9dpNgLYUA==' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36' \
  -H 'Upgrade: websocket' \
  -H 'Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: Upgrade' \
  -H 'Sec-WebSocket-Version: 13' \
  --compressed
@ylemkimon
Copy link
Contributor

The host is the part after //, the id in the case of Chrome extension. Have you tried passing the id of the extension?

@montogeek
Copy link
Member Author

@ylemkimon That does work. But still it won't reload:
image

Not sure if this is fixable, to "reload a service worker".

@alexander-akait
Copy link
Member

alexander-akait commented Sep 8, 2021

@montogeek for background tasks you should not use client, we recently had an issue for chrome extensions and I will provide fully working configuration for v4, but I can't found 😕

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

Successfully merging a pull request may close this issue.

3 participants