If there is a certificate and key in /etc/ssl/gokrazy-web.{pem,key.pem}, the webinterface will serve and redirect to https.
11 lines
253 B
Go
11 lines
253 B
Go
package gokrazy
|
|
|
|
import "net/http"
|
|
|
|
// TODO: Configurable https-port
|
|
func httpsRedirect(w http.ResponseWriter, r *http.Request) {
|
|
r.URL.Host = r.Host
|
|
r.URL.Scheme = "https"
|
|
http.Redirect(w, r, r.URL.String(), http.StatusFound) // Redirect to https
|
|
}
|