mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Added log to show which URL is blocked by CORS. (#26347)
--------- Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
71e26b8df2
commit
a040618485
@ -32,7 +32,10 @@ func connectWebSocket(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
ws, err := upgrader.Upgrade(w, r, nil)
|
||||
if err != nil {
|
||||
c.Err = model.NewAppError("connect", "api.web_socket.connect.upgrade.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||
params := map[string]any{
|
||||
"BlockedOrigin": r.Header.Get("Origin"),
|
||||
}
|
||||
c.Err = model.NewAppError("connect", "api.web_socket.connect.upgrade.app_error", params, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -465,5 +465,5 @@ func TestWebSocketUpgrade(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, resp.StatusCode, http.StatusBadRequest)
|
||||
require.NoError(t, th.TestLogger.Flush())
|
||||
testlib.AssertLog(t, buffer, mlog.LvlDebug.Name, "Failed to upgrade websocket connection.")
|
||||
testlib.AssertLog(t, buffer, mlog.LvlDebug.Name, "URL Blocked because of CORS. Url: ")
|
||||
}
|
||||
|
@ -4552,7 +4552,7 @@
|
||||
},
|
||||
{
|
||||
"id": "api.web_socket.connect.upgrade.app_error",
|
||||
"translation": "Failed to upgrade websocket connection."
|
||||
"translation": "URL Blocked because of CORS. Url: {{.BlockedOrigin}}"
|
||||
},
|
||||
{
|
||||
"id": "api.web_socket_router.bad_action.app_error",
|
||||
|
Loading…
Reference in New Issue
Block a user