@@ -13,7 +13,7 @@ import (
13
13
)
14
14
15
15
var (
16
- // DefaultUpgrader specifies the paramaters for upgrading an HTTP
16
+ // DefaultUpgrader specifies the parameters for upgrading an HTTP
17
17
// connection to a WebSocket connection.
18
18
DefaultUpgrader = & websocket.Upgrader {
19
19
ReadBufferSize : 1024 ,
@@ -24,15 +24,15 @@ var (
24
24
DefaultDialer = websocket .DefaultDialer
25
25
)
26
26
27
- // WebsocketProxy is an HTTP Handler that takes an incoming websocket
27
+ // WebsocketProxy is an HTTP Handler that takes an incoming WebSocket
28
28
// connection and proxies it to another server.
29
29
type WebsocketProxy struct {
30
30
// Backend returns the backend URL which the proxy uses to reverse proxy
31
- // the incoming websocket connection. Request is the initial incoming and
31
+ // the incoming WebSocket connection. Request is the initial incoming and
32
32
// unmodified request.
33
33
Backend func (* http.Request ) * url.URL
34
34
35
- // Upgrader specifies the paramaters for upgrading an HTTP connection to a
35
+ // Upgrader specifies the parameters for upgrading an HTTP connection to a
36
36
// WebSocket connection. If nil, DefaultUpgrader is used.
37
37
Upgrader * websocket.Upgrader
38
38
@@ -56,6 +56,9 @@ func NewProxy(target *url.URL) *WebsocketProxy {
56
56
return & WebsocketProxy {Backend : backend }
57
57
}
58
58
59
+ func (w * WebsocketProxy ) CloseNotify () {
60
+ }
61
+
59
62
// ServeHTTP implements the http.Handler that proxies WebSocket connections.
60
63
func (w * WebsocketProxy ) ServeHTTP (rw http.ResponseWriter , req * http.Request ) {
61
64
backendURL := w .Backend (req )
@@ -91,15 +94,15 @@ func (w *WebsocketProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
91
94
h .Set ("X-Forwarded-For" , clientIP )
92
95
}
93
96
94
- // Set the originating protol of the incoming HTTP request. The SSL might
97
+ // Set the originating protocol of the incoming HTTP request. The SSL might
95
98
// be terminated on our site and because we doing proxy adding this would
96
- // be helpful for applications on the backedn .
99
+ // be helpful for applications on the backend .
97
100
h .Set ("X-Forwarded-Proto" , "http" )
98
101
if req .TLS != nil {
99
102
h .Set ("X-Forwarded-Proto" , "https" )
100
103
}
101
104
102
- // Connect to the backend url , also pass the headers we prepared above.
105
+ // Connect to the backend URL , also pass the headers we prepared above.
103
106
// TODO: support multiplexing on the same backend connection instead of
104
107
// opening a new TCP connection time for each request.
105
108
connBackend , resp , err := dialer .Dial (backendURL .String (), h )
0 commit comments