Skip to content

Drop spdy in favor of node:http2 #5408

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
talentlessguy opened this issue Jan 24, 2025 · 7 comments
Closed

Drop spdy in favor of node:http2 #5408

talentlessguy opened this issue Jan 24, 2025 · 7 comments

Comments

@talentlessguy
Copy link

Modification Proposal

Remove spdy and use node built-in http2 server. spdy is broken since node 16 (source. Perhaps node:http2 could be wrapped in a way that it would be compatible with express.

Expected Behavior / Situation

Usage of http2 in favor spdy. Support for http2 and deprecation of spdy.

Actual Behavior / Situation

Lack of http2 option and only support for spdy.

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

Relevant discussions/PRs:

@Abdulkhan104
Copy link

basically its issue solve type the command :::- npm config set legacy-peer-deps true

@alexander-akait
Copy link
Member

We already support http2 out of box, but only for custom application (which support it), example for connect https://github.com/webpack/webpack-dev-server/tree/master/examples/server/http2

built-in http2 server

You can use pure http2 server using the server option like here https://github.com/webpack/webpack-dev-server/blob/master/examples/app/hono/webpack.config.js#L35C5-L35C11

spdy will removed in the next major release

Unfortunately express doesn't support http2, so it will not work

@kimyu92
Copy link

kimyu92 commented Mar 21, 2025

@alexander-akait For webpack-dev-server v5, are we sure the documentation for HTTP2 is correct with nested server key?

Does specifying http2 equivalent to supporting both HTTP2 and HTTPS2?

const connect = require("connect");

module.exports = {
  // ...
  devServer: {
    server: {
      server: "http2",
      app: () => connect(),
    },
  },
};

Shouldn't it be

const connect = require("connect");

module.exports = {
  // ...
  devServer: {
    server: {
      type: "http2",
    },
   app: () => connect(),
  },
};

Here is the snippet how https works with SSL.

    server: {
      type: 'https',
      options: {
        key: resolve(__dirname, join('some', 'path', 'dev.key')),
        cert: resolve(__dirname, join('some.', 'path', 'dev.crt')),
        ca: resolve(__dirname, join('som', 'path', 'dev.ca.pem')),
      },
    },

How would it work for HTTP2 with SSL configuration? Any guidance would be highly appreciated

@alexander-akait
Copy link
Member

@kimyu92 Can you show me where we have bad documentation? For options you can use:

server: {
      type: 'http2',
      options: {
        key: resolve(__dirname, join('some', 'path', 'dev.key')),
        cert: resolve(__dirname, join('some.', 'path', 'dev.crt')),
        ca: resolve(__dirname, join('som', 'path', 'dev.ca.pem')),
      },
    },

@kimyu92
Copy link

kimyu92 commented Mar 24, 2025

Not sure it's typo or what but it wasn't clear how to cooperate with SSL as well

https://github.com/webpack/webpack-dev-server/tree/master/examples/server/http2

@kimyu92
Copy link

kimyu92 commented Mar 24, 2025

Aside from the example above, in the official documentation, there is no http2 option listed at https://webpack.js.org/configuration/dev-server/#devserverserver

On top of that, there is also no explanation of requestCert: true, which misled ppl to think that it's required as part of SSL config

@alexander-akait
Copy link
Member

@kimyu92 You can send a PR to update our docs, look like yes, we forgot to add it

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