-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Expose config.kit.server.https
so that svelte-kit preview --https
can use user-defined cert
#1659
Comments
If you use a user-defined certificate, you should place it under the 'vite' option:
Your change will require the user to specify a key and cert, which shouldn't be required -- Kit will generate a self-signed certificate of its own if a key and cert aren't specified. In this case, the user must accept URL via the browser's "privacy error" notification. You may want to wait until the next release of svelte-kit. It will include a change that allows HMR to work properly with https. Perhaps the FAQ in the documentation should be updated to show how to set up https with your own certificates. |
Thanks for the feedback. For me the auto generated one is used if it's not specified in the config when running |
Ah, I understand.
To:
I can do the PR and modify this. As a side note -- I think the option for specifying the key and cert is used often enough that it seems it should be a "kit option" rather than a "kit.vite option". Kit is responsible for creating the server, since it runs in Vite's "middlewares" mode. However, this recommendation should be reviewed by the maintainers. I'll bring this up in the PR. |
Thanks @JBusillo, I'm not familiar with the implementation details, but from a user perspective having one setting for both |
That all depends on what the maintainers/architects think. And, perhaps to support migration during beta, a console message could be displayed when the old option is used. |
Still no proper information about how to deploy the svelte app with node adapter in HTTPS |
HTTPS is working fine for me with |
With the latest version my previous workaround no longer works. Now diff --git a/packages/kit/src/core/dev/index.js b/packages/kit/src/core/dev/index.js
index 08fa1754..099b2911 100644
--- a/packages/kit/src/core/dev/index.js
+++ b/packages/kit/src/core/dev/index.js
@@ -156,7 +156,7 @@ class Watcher extends EventEmitter {
[merged_config] = deep_merge(merged_config, {
server: {
host: this.host,
- https: this.https,
+ https: this.https && merged_config && merged_config.server && merged_config.server.https || this.https,
port: this.port
}
}); Patch for built version: diff --git a/node_modules/@sveltejs/kit/dist/chunks/index.js b/node_modules/@sveltejs/kit/dist/chunks/index.js
index 036a731..ca69c44 100644
--- a/node_modules/@sveltejs/kit/dist/chunks/index.js
+++ b/node_modules/@sveltejs/kit/dist/chunks/index.js
@@ -4332,7 +4332,7 @@ class Watcher extends EventEmitter {
[merged_config] = deep_merge(merged_config, {
server: {
host: this.host,
- https: this.https,
+ https: this.https && merged_config && merged_config.server && merged_config.server.https || this.https,
port: this.port
}
}); |
This was properly fixed in #2622 available in 1.0.0-next.188. |
Is your feature request related to a problem? Please describe.
Expose
config.kit.server.https
so thatsvelte-kit preview --https
can use user-defined cert.Describe the solution you'd like
Not tested, but suggested fix:
However I've tested the patched built version:
Describe alternatives you've considered
N/A
How important is this feature to you?
Good to have, to be able to use existing self-signed certs during development.
The text was updated successfully, but these errors were encountered: