mirror of
https://github.com/taigrr/log-socket
synced 2025-01-18 04:53:14 -08:00
detect tls presence based on incoming request for websocket
This commit is contained in:
parent
a07d3a11df
commit
b65a10e7a8
@ -7,7 +7,12 @@ import (
|
||||
)
|
||||
|
||||
func LogSocketViewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
wsResource := "ws://" + r.Host + r.URL.Path
|
||||
wsResource := r.Host + r.URL.Path
|
||||
if r.TLS != nil {
|
||||
wsResource = "wss://" + wsResource
|
||||
} else {
|
||||
wsResource = "ws://" + wsResource
|
||||
}
|
||||
wsResource = strings.TrimSuffix(wsResource, "/") + "/ws"
|
||||
homeTemplate.Execute(w, wsResource)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user