forked from labstack/echo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vishal Rana <[email protected]>
- Loading branch information
Showing
16 changed files
with
88 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package main | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/labstack/echo" | ||
"github.com/labstack/echo/middleware" | ||
) | ||
|
||
func main() { | ||
e := echo.New() | ||
e.Use(middleware.Recover()) | ||
e.Use(middleware.Logger()) | ||
e.GET("/", func(c echo.Context) error { | ||
return c.HTML(http.StatusOK, ` | ||
<h1>Welcome to Echo!</h1> | ||
<h3>TLS certificates automatically installed from Let's Encrypt :)</h3> | ||
`) | ||
}) | ||
e.StartAutoTLS(":443", []string{"<your_domain>"}, "le.cache") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
+++ | ||
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 | ||
Let's Encrypt. `Echo#StartAutoTLS` accepts address which should listen on port `443`, | ||
list of host names for security and a file path to cache the certificates. | ||
|
||
Browse to https://<your_domain>. If everything goes fine, you should see a welcome | ||
message with TLS enabled on the website. | ||
|
||
> To redirect HTTP traffic to HTTPS, you can use [redirect middleware](/middleware/redirect#https-redirect) | ||
## Server | ||
|
||
`server.go` | ||
|
||
{{< embed "auto-tls/server.go" >}} | ||
|
||
## [Source Code]({{< source "auto-tls" >}}) | ||
|
||
## Maintainers | ||
|
||
- [vishr](https://github.com/vishr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
|
||