Browse Source

Merge pull request #25 from longsleep/native_https

Native HTTPS listener
pull/28/merge
Simon Eisenmann 12 years ago
parent
commit
9b6cbda111
  1. 4
      .gitignore
  2. 8
      server.conf.in
  3. 3
      src/app/spreed-speakfreely-server/main.go

4
.gitignore vendored

@ -24,3 +24,7 @@ vendor/* @@ -24,3 +24,7 @@ vendor/*
/.sass-cache
/extra
/src/i18n/*.mo
server.key
server.csr
server.crt
server.pem

8
server.conf.in

@ -10,6 +10,14 @@ listen = 127.0.0.1:8080 @@ -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

3
src/app/spreed-speakfreely-server/main.go

@ -122,7 +122,7 @@ func handleRoomView(room string, w http.ResponseWriter, r *http.Request) { @@ -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 { @@ -358,6 +358,7 @@ func runner(runtime phoenix.Runtime) error {
}
runtime.DefaultHTTPHandler(r)
runtime.DefaultHTTPSHandler(r)
return runtime.Start()
}

Loading…
Cancel
Save