-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Add HTTPS support to the dev server #11064
Comments
I think the way to go for the hard part would be along the lines of As caddy is written in go, it should be straightforward to carve out the logic from there. The PKI handling is even done in a module. But if you'd ask me, I would rather go the opposite way and completely discontinue "hugo serve". Along the philosophy: do one thing and do it really well. Hugo + Caddy already work pretty well as a pair for local development with HTTPS "out of the box". The detour via rendering to disk shouldn't hurt much on a modern development environment (SSD) either. Hugo is one of the best SSGs today (if not the best). Caddy is pretty decent as a dev and production server. So why not try to focus on integrating these two (only the livereload capability would need to be integrated). Caddy could even use configuration from hugo config directly with very little effort. /cc @jmooring |
Would this mean that users would have to install caddy? |
@jmooring if you go by the principle "cut the logic from caddy and mimic it in hugo" - no. The latter was more meant to be "food for thought for strategic direction" of hugo development -- given that there is still a lot to be done (or on the roadmap) for the core functionality of building things. Of course, deprecating It could be as simple as an official statement: "we will not add functionality to |
That's not an option. If we add some server library, it needs to be compiled in. The I will have a look at how |
Exactly and to the point. I'd rather not open this box if I were in your shoes.
|
No, i actually think |
Sure, your call. 😃 In that case I would really take a closer look at caddy, because the UX of |
The "auto cert" handling in this PR is backed by mkcert (see link below). To get this up and running on a new PC, you can: ``` hugo server trust hugo server --certAuto ``` When `--certAuto` (or `--certFile` and `--keyFile`) is set and no `--baseURL` is provided as a flag, the server is started with TLS and `https` as the protocol. Note that you only need to run `hugo server trust` once per PC. If you already have the key and the cert file (e.g. by using mkcert directly), you can do: ``` hugo server --certFile mycert.pem --keyFile mykey.pem ``` See https://github.com/FiloSottile/mkcert Fixes gohugoio#11064 If both are set, we assume `https` in the baseURL if not set explicitly. We may add additional tooling for this, but this should at least make it possible to run Hugo's dev server with HTTPS. Closes gohugoio#1106
The "auto cert" handling in this PR is backed by mkcert (see link below). To get this up and running on a new PC, you can: ``` hugo server trust hugo server --certAuto ``` When `--certAuto` (or `--certFile` and `--keyFile`) is set and no `--baseURL` is provided as a flag, the server is started with TLS and `https` as the protocol. Note that you only need to run `hugo server trust` once per PC. If you already have the key and the cert file (e.g. by using mkcert directly), you can do: ``` hugo server --certFile mycert.pem --keyFile mykey.pem ``` See https://github.com/FiloSottile/mkcert Fixes gohugoio#11064
The "auto cert" handling in this PR is backed by mkcert (see link below). To get this up and running on a new PC, you can: ``` hugo server trust hugo server --tlsAuto ``` When `--tlsAuto` (or `--tlsCertFile` and `--tlsKeyFile`) is set and no `--baseURL` is provided as a flag, the server is started with TLS and `https` as the protocol. Note that you only need to run `hugo server trust` once per PC. If you already have the key and the cert file (e.g. by using mkcert directly), you can do: ``` hugo server --tlsCertFile mycert.pem --tlsKeyFile mykey.pem ``` See https://github.com/FiloSottile/mkcert Fixes gohugoio#11064
The "auto cert" handling in this PR is backed by mkcert (see link below). To get this up and running on a new PC, you can: ``` hugo server trust hugo server --tlsAuto ``` When `--tlsAuto` (or `--tlsCertFile` and `--tlsKeyFile`) is set and no `--baseURL` is provided as a flag, the server is started with TLS and `https` as the protocol. Note that you only need to run `hugo server trust` once per PC. If you already have the key and the cert file (e.g. by using mkcert directly), you can do: ``` hugo server --tlsCertFile mycert.pem --tlsKeyFile mykey.pem ``` See https://github.com/FiloSottile/mkcert Fixes gohugoio#11064
* commands: Add TLS/HTTPS support to hugo server The "auto cert" handling in this PR is backed by mkcert (see link below). To get this up and running on a new PC, you can: ``` hugo server trust hugo server --tlsAuto ``` When `--tlsAuto` (or `--tlsCertFile` and `--tlsKeyFile`) is set and no `--baseURL` is provided as a flag, the server is started with TLS and `https` as the protocol. Note that you only need to run `hugo server trust` once per PC. If you already have the key and the cert file (e.g. by using mkcert directly), you can do: ``` hugo server --tlsCertFile mycert.pem --tlsKeyFile mykey.pem ``` See https://github.com/FiloSottile/mkcert Fixes #11064
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Which also should have some support for create local trusted dev certificates (the hard part).
The text was updated successfully, but these errors were encountered: