Skip to content

Commit

Permalink
removal of cors passthru for websockets
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Oct 18, 2023
1 parent 0f62194 commit 0a308a1
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions command/agent/job_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,20 +401,8 @@ func (s *HTTPServer) jobRunAction(resp http.ResponseWriter, req *http.Request, j
// (Can use the job-level action lookup to do this most effectively, probably!)
// or: maybe, should group/task/action lookup all happen in the RPC handler?

// conn, err := s.wsUpgrader.Upgrade(resp, req, nil)
// FIXME: this is an open checkOrigin here that allows :4200 to make requests to :4646,
// freeing local ember up from not having to proxy.
// This is like three workarounds in a trenchcoat and I dno't feel good about it but it unblocks me

var upgrader = websocket.Upgrader{
// Allow all origins
CheckOrigin: func(r *http.Request) bool { return true },
}

s.logger.Info("jobRunAction called with upgrader: %v", upgrader)

// Then when you upgrade the connection:
conn, err := upgrader.Upgrade(resp, req, nil)
conn, err := s.wsUpgrader.Upgrade(resp, req, nil)
s.logger.Info("jobRunAction called with upgrader")

if err != nil {
return nil, fmt.Errorf("failed to upgrade connection: %v", err)
Expand Down

0 comments on commit 0a308a1

Please sign in to comment.