File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55require (
66 github.com/gorilla/websocket v1.4.2
7+ github.com/rs/cors v1.7.0
78 github.com/satori/go.uuid v1.2.0
89)
Original file line number Diff line number Diff line change 11github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc =
22github.com/gorilla/websocket v1.4.2 /go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE =
3+ github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik =
4+ github.com/rs/cors v1.7.0 /go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU =
35github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww =
46github.com/satori/go.uuid v1.2.0 /go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0 =
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package main
22
33import (
44 "github.com/TouchDeck/websocket-proxy/pkg/proxy"
5+ "github.com/rs/cors"
56 "log"
67 "net/http"
78)
@@ -17,7 +18,8 @@ func main() {
1718
1819 // Start the HTTP server.
1920 log .Println ("Starting HTTP server on port 8783" )
20- err := http .ListenAndServe (":8783" , mux )
21+ handler := cors .AllowAll ().Handler (mux )
22+ err := http .ListenAndServe (":8783" , handler )
2123 if err != nil {
2224 log .Fatalln ("Error starting websocket server:" , err )
2325 }
You can’t perform that action at this time.
0 commit comments