Skip to content

Commit 4fe0f44

Browse files
committed
insecureSkipVerify env variable
1 parent 4ffb5df commit 4fe0f44

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ environment variables:
88

99
- _PORT_: set port to listen on
1010
- _PATHS_: key-value pairs (separated by `:`) of endpoints to backend mappings, several can be added divided by `,`, eg: `google:https://google.com,reddit:https://reddit.com`
11+
- _INSECURE_SKIP_VERIFY=yes_: whether to skip verifying TLS certs

cmd/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"crypto/tls"
45
"fmt"
56
"io"
67
"log"
@@ -90,6 +91,11 @@ func handler(w http.ResponseWriter, r *http.Request) {
9091
}
9192

9293
func main() {
94+
if strings.TrimSpace(os.Getenv("INSECURE_SKIP_VERIFY")) == "yes" {
95+
fmt.Println("InsecureSkipVerify enabled")
96+
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
97+
}
98+
9399
port := os.Getenv("PORT")
94100
if port == "" {
95101
port = "8080"

0 commit comments

Comments
 (0)