Skip to content

Commit 86d054d

Browse files
committed
Test allowed origins on startup.
1 parent ba94039 commit 86d054d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/api/handlers/monitor.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ func checkOrigin(origin string, allowedOrigins []string) bool {
127127
}
128128

129129
func HandleMonitorWS(allowedOrigins []string) http.HandlerFunc {
130+
// Do a dry-run of checkorigin, so it can panic if misconfigured now, not on first request
131+
_ = checkOrigin("http://example.com:8000", allowedOrigins)
132+
130133
upgrader := websocket.Upgrader{
131134
ReadBufferSize: 1024,
132135
WriteBufferSize: 1024,

0 commit comments

Comments
 (0)