Skip to content

Commit b9df55c

Browse files
cmagliemirkoCrobu
authored andcommitted
fix: Use a valid origin in the config check for websockets (#41)
1 parent a58a518 commit b9df55c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

internal/api/handlers/monitor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func checkOrigin(origin string, allowedOrigins []string) bool {
128128

129129
func HandleMonitorWS(allowedOrigins []string) http.HandlerFunc {
130130
// Do a dry-run of checkorigin, so it can panic if misconfigured now, not on first request
131-
_ = checkOrigin("http://example.com:8000", allowedOrigins)
131+
_ = checkOrigin("http://localhost", allowedOrigins)
132132

133133
upgrader := websocket.Upgrader{
134134
ReadBufferSize: 1024,

internal/api/handlers/monitor_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func TestCheckOrigin(t *testing.T) {
4141
allow("wails://wails")
4242
allow("wails://wails:8000")
4343
allow("http://wails.localhost")
44+
allow("http://localhost")
4445
allow("http://example.com:7000")
4546
allow("https://blah.com:443")
4647
deny("wails://evil.com")

0 commit comments

Comments
 (0)