danielbeck, sorry to say but this is clearly a bug and even one that makes the CLI usage very hard. The fact that `X-SSH-Endpoint` is not reported for unauthorized requests makes impossible to use SSH cli due to:
+ export JENKINS_HOSTNAME=rhos-ci-staging-jenkins.example.com
+ export JENKINS_USERNAME=ssbarnea
+ export JENKINS_TOKEN=xxx
+ export JENKINS_URL=https:+ curl -sD - -o /dev/null -X GET https:HTTP/1.1 200 OK
Server: nginx/1.10.2
Date: Thu, 24 Aug 2017 11:11:51 GMT
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Content-Type-Options: nosniff
Set-Cookie: JSESSIONID.54abbce6=1av7nndlrni8wlqzw3cbvcchv;Path=/;Secure;HttpOnly
Expires: 0
Cache-Control: no-cache,no-store,must-revalidate
X-Hudson-Theme: default
X-Hudson: 1.395
X-Jenkins: 2.60.3
X-Jenkins-Session: b2a74a15
X-Hudson-CLI-Port: 50000
X-Jenkins-CLI-Port: 50000
X-Jenkins-CLI2-Port: 50000
X-Frame-Options: sameorigin
X-Instance-Identity: ...
X-SSH-Endpoint: rhos-ci-staging-jenkins.example.com:50022
Strict-Transport-Security: max-age=63072000; includeSubDomains
X-Content-Type-Options: nosniff
+ java -jar jenkins-cli.jar -ssh -user ssbarnea -i /Users/ssbarnea/.ssh/id_rsa.rhos-jenkins -p rhos-ci-staging-jenkins.example.com:50000 -logger FINEST help
Aug 24, 2017 12:11:52 PM hudson.cli.CLI _main
FINE: using connection mode SSH
Aug 24, 2017 12:11:53 PM hudson.cli.SSHCLI sshConnection
WARNING: No header 'X-SSH-Endpoint' returned by Jenkins
FAIL: 255
This means that's impossible to use SSH port without first authentication to Jenkins via HTTP.
The fact that the other ports are exposed is another reason to consider this a bug.
Do I really have to modify our NGINX to add this missing headers in order to make the CLI via SSH usable?
And correction: the header is missing even from instances that allow anonymous access. For example we are using Kerberos based authentication and we allow read-only anonymous access, the header is missing unless we make requests with BASIC-auth (tokens),... which cripples the user experience.
Historically, Jenkins allowed anyone read access, to the top URL wasn't the 403. The wiki is descriptive, open to edit by anyone, and not kept well up to date, so take its content with a grain of salt.
The better maintained Jenkins handbook specifically mentions the login URL: https://jenkins.io/doc/book/managing/cli/