- 
      
 - 
        
Save jaymecd/a8474e9d646e3842dc0e1f22db8b5e8e to your computer and use it in GitHub Desktop.  
Revisions
- 
        
d-schmidt revised this gist
Oct 5, 2015 . 1 changed file with 0 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,14 @@ package main import ( "net/http" ) func redirect(w http.ResponseWriter, req *http.Request) { http.Redirect(w, req, "https://" + req.Host + req.URL.String(), http.StatusMovedPermanently) } func index(w http.ResponseWriter, req *http.Request) { // all calls to unknown url paths should return 404 if req.URL.Path != "/" { @@ -21,7 +18,6 @@ func index(w http.ResponseWriter, req *http.Request) { http.ServeFile(w, req, "index.html") } func main() { // redirect every http request to https go http.ListenAndServe(":80", http.HandlerFunc(redirect))  - 
        
d-schmidt revised this gist
Oct 5, 2015 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ package main import ( "net/http" ) func redirect(w http.ResponseWriter, req *http.Request) { http.Redirect(w, req, "https://" + req.Host + req.URL.String(), http.StatusMovedPermanently) } @@ -25,7 +25,7 @@ func index(w http.ResponseWriter, req *http.Request) { func main() { // redirect every http request to https go http.ListenAndServe(":80", http.HandlerFunc(redirect)) // serve index (and anything else) as https mux := http.NewServeMux() mux.HandleFunc("/", index) http.ListenAndServeTLS(":443", "cert.pem", "key.pem", mux)  - 
        
d-schmidt created this gist
Oct 5, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ package main import ( "net/http" ) func redirect(w http.ResponseWriter, req *http.Request) { http.Redirect(w, req, "https://" + req.Host + req.URL.String(), http.StatusMovedPermanently) } func index(w http.ResponseWriter, req *http.Request) { // all calls to unknown url paths should return 404 if req.URL.Path != "/" { http.NotFound(w, req) return } http.ServeFile(w, req, "index.html") } func main() { // redirect every http request to https go http.ListenAndServe(":80", http.HandlerFunc(redirect)) // serve index (and anything else) using tls mux := http.NewServeMux() mux.HandleFunc("/", index) http.ListenAndServeTLS(":443", "cert.pem", "key.pem", mux) }