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

ACME Server TLS example with Let's Encrypt and certmagic #125

Merged
merged 3 commits into from
Jun 25, 2024

Conversation

redecs
Copy link
Contributor

@redecs redecs commented Apr 19, 2024

Full example for a TLS setup with Fuego. This example should get you very close to a production setup with HTTPS (and HTTP/2), automatic TLS certificates (with auto-renew) and HTTP to HTTPS redirect.

Key points:

  • Used certmagic for ACME Server integration: Let's Encrypt Staging
  • Runs also an HTTP server (using net/http) to solve the HTTP challenge for the ACME server
  • Set's a custom tls.Config from certmagic on the Fuego's underlying http.Server
  • Graceful shutdown for both HTTP and HTTPS servers

This is examples is meant to be run on server that has a real DNS record pointing to it, with ports 80 and 443 opened. You need to provide the domain name and email address using flags.

While initially I was considering autocert I found to certmagic from Caddy to be more powerful.

@EwenQuim
Copy link
Member

Thanks! Could you remove the chi import by running go mod tidy ? I think it isn't useful here

@redecs
Copy link
Contributor Author

redecs commented Jun 25, 2024

Done! Yes, you're right, I copy-pasted other example and forgot to clean it up.

@EwenQuim EwenQuim merged commit d718140 into go-fuego:main Jun 25, 2024
4 checks passed
@EwenQuim
Copy link
Member

Thank you very much! 🔥

@redecs redecs deleted the acme-tls branch June 25, 2024 23:14
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 this pull request may close these issues.

2 participants