2016-11-29 06:30:42 +02:00
|
|
|
+++
|
|
|
|
title = "Auto TLS Example"
|
|
|
|
description = "Automatic TLS certificates from Let's Encrypt example for Echo"
|
|
|
|
[menu.main]
|
|
|
|
name = "Auto TLS"
|
|
|
|
parent = "recipes"
|
|
|
|
weight = 2
|
|
|
|
+++
|
|
|
|
|
|
|
|
This recipe shows how to obtain TLS certificates for a domain automatically from
|
2016-12-02 19:28:18 +02:00
|
|
|
Let's Encrypt. `Echo#StartAutoTLS` accepts an address which should listen on port `443`.
|
2016-11-29 06:30:42 +02:00
|
|
|
|
2016-12-14 06:26:25 +02:00
|
|
|
Browse to `https://<DOMAIN>`. If everything goes fine, you should see a welcome
|
2016-11-29 06:30:42 +02:00
|
|
|
message with TLS enabled on the website.
|
|
|
|
|
2016-12-02 19:28:18 +02:00
|
|
|
>
|
2016-12-09 20:24:14 +02:00
|
|
|
- For added security you should specify host policy in auto TLS manager
|
2016-12-02 19:28:18 +02:00
|
|
|
- To redirect HTTP traffic to HTTPS, you can use [redirect middleware](/middleware/redirect#https-redirect)
|
2016-11-29 06:30:42 +02:00
|
|
|
|
|
|
|
## Server
|
|
|
|
|
|
|
|
`server.go`
|
|
|
|
|
|
|
|
{{< embed "auto-tls/server.go" >}}
|
|
|
|
|
|
|
|
## [Source Code]({{< source "auto-tls" >}})
|
|
|
|
|
|
|
|
## Maintainers
|
|
|
|
|
|
|
|
- [vishr](https://github.com/vishr)
|