Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Listen on HTTP and provide redirect (if non-secure URL is defined)
- if len(config.NonSecureURL) > 0 {
- go func() {
- redirect := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- http.Redirect(w, req, "https://"+config.SecureURL+req.RequestURI, 302)
- })
- log.Error(http.ListenAndServe(config.NonSecureURL, redirect))
- }()
- }
- log.Fatal(http.ListenAndServeTLS(config.SecureURL, config.Certificate, config.Key, router))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement