소스 검색

Allow websocket connections from any origin

master
Jan Svabenik 3 일 전
부모
커밋
06ce381bb9
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. +5
    -1
      cmd/sdrd/main.go

+ 5
- 1
cmd/sdrd/main.go 파일 보기

@@ -334,7 +334,11 @@ func main() {

upgrader := websocket.Upgrader{CheckOrigin: func(r *http.Request) bool {
origin := r.Header.Get("Origin")
return origin == "" || strings.HasPrefix(origin, "http://localhost") || strings.HasPrefix(origin, "http://127.0.0.1")
if origin == "" || origin == "null" {
return true
}
// allow same-host or any local IP
return true
}}
http.HandleFunc("/ws", func(w http.ResponseWriter, r *http.Request) {
conn, err := upgrader.Upgrade(w, r, nil)


불러오는 중...
취소
저장