backport of commit 99e54da9a9aeb3a62a05f50af1dcc74c06cd9657 (#18797)
Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
This commit is contained in:
parent
897bcef932
commit
8f1713dcd4
|
@ -45,13 +45,10 @@ module.exports = function (app, options) {
|
|||
proxy.web(req, res, { target: proxyAddress });
|
||||
});
|
||||
|
||||
server.on('upgrade', function (req, socket, head) {
|
||||
if (
|
||||
req.url.startsWith('/v1/client/allocation') &&
|
||||
req.url.includes('exec?')
|
||||
) {
|
||||
req.headers.origin = proxyAddress;
|
||||
proxy.ws(req, socket, head, { target: proxyAddress });
|
||||
}
|
||||
server.on('upgrade', function (req) {
|
||||
// Set Origin header so Nomad accepts the proxied request.
|
||||
// WebSocket proxing is handled by ember-cli.
|
||||
// https://github.com/ember-cli/ember-cli/blob/v3.28.5/lib/tasks/server/middleware/proxy-server/index.js#L51
|
||||
req.headers.origin = proxyAddress;
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue