Skip to content

Commit b73d503

Browse files
committed
websocketproxy: return with known error if backend url is nil
1 parent 7eef773 commit b73d503

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

websocketproxy.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ func (w *WebsocketProxy) CloseNotify() {
6262
// ServeHTTP implements the http.Handler that proxies WebSocket connections.
6363
func (w *WebsocketProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
6464
backendURL := w.Backend(req)
65+
if backendURL == nil {
66+
log.Println("websocketproxy: backend URL is nil")
67+
http.Error(rw, "internal server error", http.StatusInternalServerError)
68+
return
69+
}
6570

6671
dialer := w.Dialer
6772
if w.Dialer == nil {

0 commit comments

Comments
 (0)