Skip to content

Instantly share code, notes, and snippets.

@ivanvanderbyl
Created March 28, 2014 00:05
Show Gist options
  • Save ivanvanderbyl/9821989 to your computer and use it in GitHub Desktop.
Save ivanvanderbyl/9821989 to your computer and use it in GitHub Desktop.
SSL static file server
package main
import (
"log"
"net/http"
)
func main() {
http.Handle("/versions/", http.StripPrefix("/versions/", http.FileServer(http.Dir("/tmp"))))
log.Printf("About to listen on 10443. Go to https://127.0.0.1:10443/")
err := http.ListenAndServeTLS(":10443", "cert.pem", "key.pem", nil)
if err != nil {
log.Fatal(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment