add proper content type to force the browser to download the files instead of rendering their content
This commit is contained in:
parent
c639bddaeb
commit
5b6c21ef6d
@ -1,15 +1,19 @@
|
|||||||
package http
|
package http
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ServeCertificate() {
|
func ServeCertificate() {
|
||||||
http.HandleFunc("/server.key", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/server.key", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Set("Content-Type", "application/octet-stream")
|
||||||
http.ServeFile(w, r, "/certs/server.key")
|
http.ServeFile(w, r, "/certs/server.key")
|
||||||
})
|
})
|
||||||
http.HandleFunc("/server.pem", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/server.pem", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Set("Content-Type", "application/x-x509-ca-cert")
|
||||||
http.ServeFile(w, r, "/certs/server.pem")
|
http.ServeFile(w, r, "/certs/server.pem")
|
||||||
})
|
})
|
||||||
|
log.Printf("Serving cert files on :9229\n")
|
||||||
http.ListenAndServe(":9229", nil)
|
http.ListenAndServe(":9229", nil)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user