diff --git a/.gitignore b/.gitignore index e6f51d70..651650c2 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,7 @@ vendor/* /.sass-cache /extra /src/i18n/*.mo +server.key +server.csr +server.crt +server.pem diff --git a/server.conf.in b/server.conf.in index 07bf5f80..8c8388f9 100644 --- a/server.conf.in +++ b/server.conf.in @@ -10,6 +10,14 @@ listen = 127.0.0.1:8080 #stats = true # Provide stats API at /api/v1/stats (do not enable this in production or unprotected!). #pprofListen = 127.0.0.1:6060 # See http://golang.org/pkg/net/http/pprof/ for details +[https] +#listen = 127.0.0.1:8443 +#certificate = server.crt # Full path to certificate. +#key = server.key # Full path to key. +#minVersion = SSLv3 # Minimal supported encryption (SSLv3, TLSv1, TLSv1.1, TLSv1.2). +#readtimeout = 10 +#writetimeout = 10 + [app] #title = Spreed Speak Freely #ver = 1234 # version string to use for static resource diff --git a/src/app/spreed-speakfreely-server/main.go b/src/app/spreed-speakfreely-server/main.go index 49e4f4b8..5310362e 100644 --- a/src/app/spreed-speakfreely-server/main.go +++ b/src/app/spreed-speakfreely-server/main.go @@ -122,7 +122,7 @@ func handleRoomView(room string, w http.ResponseWriter, r *http.Request) { w.Header().Set("Cache-Control", "private, max-age=0") // Detect if the request was made with SSL. - ssl := false + ssl := r.TLS != nil proto, ok := r.Header["X-Forwarded-Proto"] if ok { ssl = proto[0] == "https" @@ -358,6 +358,7 @@ func runner(runtime phoenix.Runtime) error { } runtime.DefaultHTTPHandler(r) + runtime.DefaultHTTPSHandler(r) return runtime.Start() }