Closed Willyarma closed 1 day ago
I added allow_origin: "http://192.168.5.49:8888" to the config.yml and it only affects the get and post part of the API it does not affect the websocket. Putting "*" dosent work either for websockets but does for get/post.
I hacked it for the time being just to get it going...
m.HandleFunc("/events", func(w http.ResponseWriter, r *http.Request) {
opts := &websocket.AcceptOptions{}
if len(s.allowOrigin) > 0 {
//opts.OriginPatterns = []string{s.allowOrigin}
}
opts.InsecureSkipVerify = true
obviously this isnt the right way
@Willyarma Can you test again with the latest changes?
I'm using a node.js wrapper that I wrote with a minimal web interface, the HTTP server of it is on port 8888.
Without specifying allow_origin in config.yml, get/post gives cors errors in the firefox web console, the websocket won't connect.
allow_origin: "*" works for both get/post and websockets allow_origin: "http://192.168.5.49:8888" also works allow_origin: "192.168.5.49:8888" only works for websockets
Would it be worth mentioning requiring allow_origin in the main readme?
Thanks for fixing it so quickly.
Added to the README for clarity. Thank you for reporting!
I'm getting this message:
time="2024-09-11T10:43:47+01:00" level=error msg="failed accepting websocket connection" error="failed to accept WebSocket connection: request Origin \"http://192.168.5.49:8888\" is not authorized for Host \"192.168.5.49:3678\""
Am I doing something wrong?
config.yml: device_name: go-librespot credentials: type: zeroconf server: enabled: true port: 3678