billchurch / webssh2

Web SSH Client using ssh2, socket.io, xterm.js, and express. webssh webssh2
MIT License
2.36k stars 536 forks source link

Proxy SSH connection to multiple servers from the same browser #348

Open zouguanrong opened 1 year ago

zouguanrong commented 1 year ago

What happened?

for example: Same Browser Access: http://localhost:2222/ssh/host/172.16.7.18 http://localhost:2222/ssh/host/172.16.7.19 In reality only the first accessed url will have the authentication username and password popup, subsequent url accesses will use the data from the first visit (req.headers.authorization). (req.headers.authorization) is always the first time data is fetched.

Node Version

v18.16.1

NPM Version

9.5.1

Server OS Version

Ubuntu 22.04.3 LTS

WebSSH2 release version

0.5.0-pre-5

OS and Version of SSH server

No response

Browser Version

No response

Relevant log output

(req.headers.authorization) is always the first time data is fetched.
code:
function auth (req) {
  if (!req) {
    throw new TypeError('argument req is required')
  }

  if (typeof req !== 'object') {
    throw new TypeError('argument req is required to be an object')
  }

  // get header
  var header = getAuthorization(req)

  // parse header
  return parse(header)
}