Skip to content

Commit

Permalink
Removal of temporary fix to proxy to 4646
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Oct 18, 2023
1 parent 3a931d1 commit 95923c0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 30 deletions.
14 changes: 1 addition & 13 deletions command/agent/alloc_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,19 +504,7 @@ func (s *HTTPServer) allocExec(allocID string, resp http.ResponseWriter, req *ht
}
s.parse(resp, req, &args.QueryOptions.Region, &args.QueryOptions)

// 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 },
}

// Then when you upgrade the connection:
conn, err := upgrader.Upgrade(resp, req, nil)

conn, err := s.wsUpgrader.Upgrade(resp, req, nil)
if err != nil {
return nil, fmt.Errorf("failed to upgrade connection: %v", err)
}
Expand Down
17 changes: 4 additions & 13 deletions ui/app/services/sockets.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,12 @@ export default class SocketsService extends Service {
},
});
} else {
const shouldForward = config.APP.deproxyWebsockets;

const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';

// FIXME: Temporary, local ember implementation to get around websocket proxy issues duiring development.
let prefix;
const applicationAdapter = getOwner(this).lookup('adapter:application');
const prefix = `${
applicationAdapter.host || window.location.host
}/${applicationAdapter.urlPrefix()}`;
const region = this.system.activeRegion;
if (!shouldForward) {
const applicationAdapter = getOwner(this).lookup('adapter:application');
prefix = `${
applicationAdapter.host || window.location.host
}/${applicationAdapter.urlPrefix()}`;
} else {
prefix = 'localhost:4646/v1';
}

return new WebSocket(
`${protocol}//${prefix}/client/allocation/${taskState.allocation.id}` +
Expand Down
4 changes: 0 additions & 4 deletions ui/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ module.exports = function (environment) {
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;

// FIXME: Temporary, local ember implementation
// to get around websocket proxy issues duiring development.
ENV.APP.deproxyWebsockets = true;

ENV['ember-cli-mirage'] = {
enabled: USE_MIRAGE,
excludeFilesFromBuild: !USE_MIRAGE,
Expand Down

0 comments on commit 95923c0

Please sign in to comment.