Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckOrigin doesn't work , how to set cors #99

Open
cagev opened this issue Jul 21, 2021 · 2 comments
Open

CheckOrigin doesn't work , how to set cors #99

cagev opened this issue Jul 21, 2021 · 2 comments

Comments

@cagev
Copy link

cagev commented Jul 21, 2021

//here is my options
opts := sockjs.DefaultOptions
opts.ResponseLimit = 4096
opts.RawWebsocket = true
opts.CheckOrigin = func(r *http.Request) bool {
fmt.Printf("check origin request %v\n", r.URL)

	return true
}
opts.Origin = "*"
opts.WebsocketUpgrader = &websocket.Upgrader{}
opts.WebsocketUpgrader.CheckOrigin = func(r *http.Request) bool { return true }

wsHandler := &WSockHandler{prefix, sockjs.NewHandler(prefix, opts, handler)}
@FZambia
Copy link
Collaborator

FZambia commented Jan 27, 2022

@cagev hello, is this still actual? Setting CORS with sockjs-go works for me, but looking on the example you provided it's not obvious why it's not working to you. Can you provide a full example with steps to reproduce an issue locally?

@withlin
Copy link

withlin commented May 9, 2022

same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants