99designs / 99designs/gqlgen

Broken CORS w/ WebSocket example

未關閉
#1,328 6 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Go
星號
10.8k
分支
1.3k
平均合併
2 天 36 分鐘
30 天內合併 PR
26

描述

### What happened?

When connecting via Apollo WebSocket link, it fails to connect due following error:
`Error during WebSocket handshake: Unexpected response code: 403`

Checking server logs, following error is spotted:
```
[cors] 2020/09/14 12:44:17 Actual response added headers: map[Access-Control-Allow-Credentials:[true] Access-Control-Allow-Origin:[http://localhost:8080] Vary:[Origin]]
2020/09/14 12:44:17 unable to upgrade *http.response to websocket websocket: request origin not allowed by Upgrader.CheckOrigin:
2020/09/14 12:44:17 http: superfluous response.WriteHeader call from github.com/99designs/gqlgen/graphql/handler/transport.SendError (error.go:15)
```

### What did you expect?

That it works...

### Minimal graphql.schema and models to reproduce

https://gqlgen.com/recipes/cors/

### versions
- `latest gqlgen version`?
- `1.15`?
- go modules

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。