Skip to content

chore: CORs option for yarn dev server #7630

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

Merged
merged 10 commits into from
May 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix csp
  • Loading branch information
Emyrk committed May 22, 2023
commit d5b8893aba43d2839f09d15c4e1c453ba18da31f
4 changes: 4 additions & 0 deletions coderd/httpmw/csp.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ func CSPHeaders(websocketHosts func() []string) func(next http.Handler) http.Han
extraConnect := websocketHosts()
if len(extraConnect) > 0 {
for _, extraHost := range extraConnect {
if extraHost == "*" {
// '*' means all, which means we only need the prefixes.
extraHost = ""
}
cspSrcs.Append(cspDirectiveConnectSrc, fmt.Sprintf("wss://%[1]s ws://%[1]s", extraHost))
// We also require this to make http/https requests to the workspace proxy for latency checking.
cspSrcs.Append(cspDirectiveConnectSrc, fmt.Sprintf("https://%[1]s http://%[1]s", extraHost))
Expand Down