@@ -13,7 +13,7 @@ import (
1313)
1414
1515var (
16- // DefaultUpgrader specifies the paramaters for upgrading an HTTP
16+ // DefaultUpgrader specifies the parameters for upgrading an HTTP
1717 // connection to a WebSocket connection.
1818 DefaultUpgrader = & websocket.Upgrader {
1919 ReadBufferSize : 1024 ,
@@ -24,15 +24,15 @@ var (
2424 DefaultDialer = websocket .DefaultDialer
2525)
2626
27- // WebsocketProxy is an HTTP Handler that takes an incoming websocket
27+ // WebsocketProxy is an HTTP Handler that takes an incoming WebSocket
2828// connection and proxies it to another server.
2929type WebsocketProxy struct {
3030 // 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
3232 // unmodified request.
3333 Backend func (* http.Request ) * url.URL
3434
35- // Upgrader specifies the paramaters for upgrading an HTTP connection to a
35+ // Upgrader specifies the parameters for upgrading an HTTP connection to a
3636 // WebSocket connection. If nil, DefaultUpgrader is used.
3737 Upgrader * websocket.Upgrader
3838
@@ -56,6 +56,9 @@ func NewProxy(target *url.URL) *WebsocketProxy {
5656 return & WebsocketProxy {Backend : backend }
5757}
5858
59+ func (w * WebsocketProxy ) CloseNotify () {
60+ }
61+
5962// ServeHTTP implements the http.Handler that proxies WebSocket connections.
6063func (w * WebsocketProxy ) ServeHTTP (rw http.ResponseWriter , req * http.Request ) {
6164 backendURL := w .Backend (req )
@@ -91,15 +94,15 @@ func (w *WebsocketProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
9194 h .Set ("X-Forwarded-For" , clientIP )
9295 }
9396
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
9598 // 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 .
97100 h .Set ("X-Forwarded-Proto" , "http" )
98101 if req .TLS != nil {
99102 h .Set ("X-Forwarded-Proto" , "https" )
100103 }
101104
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.
103106 // TODO: support multiplexing on the same backend connection instead of
104107 // opening a new TCP connection time for each request.
105108 connBackend , resp , err := dialer .Dial (backendURL .String (), h )
0 commit comments