Using websocket under the gin framework, this error will be reported if it is a cross-domain request
request origin not allowed by Upgrader.CheckOrigin
The websocket library used is “github.com/gorilla/websocket”
Need to add the following code:
upgrader = websocket.Upgrader{ ReadBufferSize: 1024 , WriteBufferSize: 1024 , // Resolve cross-domain problems CheckOrigin: func(r *http.Request) bool { return true }, }
Read More:
- How to Solve Vue & Django Cross-domain Issue
- Spring boot uses configuration interface webmvcconfigurer to solve cross domain problems
- Error received: error: xhr’get’to URL cross domain [How to Solve]
- [Solved] Websocket Error: WebSocket is already in CLOSING or CLOSED state
- There was an unexpected error (type=Method Not Allowed, status=405). Request
- [Solved] ERROR_POLICY: attempt to perform an operation not allowed by the security policy `PDF‘ @ error/const
- [Nginx] Configure nginx to support websocket to solve the problem of returning 400 error
- [Solved] Mac Install homebrew Error: error: Not a valid ref: refs/remotes/origin/master
- How to Solve Nginx cross compilation Error
- [Solved] An error occurred while processing your request…enable the Development environment by setting …
- [Solved] Unity Error: “Not allowed to access vertices on mesh”
- [Solved] Access to XMLHttpRequest at ‘http://127.0.0.1:5000/markdownlang/‘ from origin ‘null‘ has been bl
- [Solved] Chrome Error: The request client is not a secure context
- Current request is not a multipart request [How to Solve]
- error: remote origin already exists [How to Solve]
- error: remote origin already exists. [How to Solve]
- [Solved] HTTP Error 405.0-Method Not Allowed occurs in the Put operation of the REST service on IIS7.5
- [How to Fix] manual close is not allowed over a Spring managed SqlSession
- Fuseki failed with message “Parse error: [line:1, col: 1] Content is not allowed in prolog.“
- error A2031: gisters not allowed [How to Solve]