Check origin in websocket in prod mode only

This commit is contained in:
Jannis Mattheis 2018-03-15 21:50:26 +01:00 committed by Jannis Mattheis
parent 5bf7f0154a
commit ee37eafd36
1 changed files with 5 additions and 0 deletions

View File

@ -8,11 +8,16 @@ import (
"github.com/gorilla/websocket"
"github.com/gotify/server/auth"
"github.com/gotify/server/model"
"net/http"
"github.com/gotify/server/mode"
)
var upgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
CheckOrigin: func(r *http.Request) bool {
return mode.IsDev();
},
}
// The API provides a handler for a WebSocket stream API.