Skip to content
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

[Feature]: When using HTTPS, it defaults to using a self-signed certificate. #2175

Closed
nanianlisao opened this issue Apr 23, 2024 · 2 comments

Comments

@nanianlisao
Copy link
Contributor

What problem does this feature solve?

I think it should be like webpack-dev-server; for most scenarios, a self-signed certificate should suffice.

Moreover, I believe that mkcert presents a certain level of initial learning curve for developers' local environments. Therefore, I think integrating a self-signed certificate might also be a better approach.

What does the proposed API look like?

The external API remains as usual, except that the server.https configuration supports a boolean.

When set to true or when cert and key do not exist, it will automatically create and use a self-signed certificate.

export default defineConfig({
  server: {
    https: true
  }
});

Of course, self-signed certificates indeed have issues with browser trust, but I think the framework leans more towards being usable out of the box. We can still recommend users to use mkcert, but internally, there should be a fallback solution.

@chenjiahan
Copy link
Member

This can be supported by a standalone Rsbuild plugin, like https://www.npmjs.com/package/@vitejs/plugin-basic-ssl

@nanianlisao
Copy link
Contributor Author

I might not quite agree with the view that it should be made into a separate plugin.

First of all, npm packages like selfsigned already have the capability to accomplish similar functions, so creating a separate plugin might not offer significant benefits.

Moreover, for rsbuild, this seems to be only related to the dev-server, hence I believe it should simply be implemented as a util function within the dev-server itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants