Skip to content

[JENKINS-48778] JNLP not considering plain hostnames when evaluating NO_PROXY #1297

Closed

Description

@jenkins-infra-bot

Encountering a 502 Bad Gateway error when fetching the slave-agent.jnlp file through the swarm client. I have traced this down to being an issue with the way the no_proxy settings are evaluated in Jenkins remoting (swarm is currently evaluating the proxy settings correctly but remoting is not). It currently will ignore any no_proxy settings that consist of hostnames without a domain suffix, i.e. "localhost" or "jenkinsmaster".

The use case for this is that I am running a docker swarm on a corporate proxy and need to be able to exclude my Jenkins master from the proxy in order for the slaves to be able to communicate.

I believe this is a simple fix here: https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/Util.java#L132-L140

The regex should be changed such that the '.' is optional and that the hostname/domain can have underscores '_'.


Originally reported by ajhodges, imported from: JNLP not considering plain hostnames when evaluating NO_PROXY
  • status: Resolved
  • priority: Minor
  • component(s): remoting
  • resolution: Fixed
  • resolved: 2018-12-10T22:50:15+00:00
  • votes: 1
  • watchers: 3
  • imported: 2025-11-25
Raw content of original issue

Encountering a 502 Bad Gateway error when fetching the slave-agent.jnlp file through the swarm client. I have traced this down to being an issue with the way the no_proxy settings are evaluated in Jenkins remoting (swarm is currently evaluating the proxy settings correctly but remoting is not). It currently will ignore any no_proxy settings that consist of hostnames without a domain suffix, i.e. "localhost" or "jenkinsmaster".

The use case for this is that I am running a docker swarm on a corporate proxy and need to be able to exclude my Jenkins master from the proxy in order for the slaves to be able to communicate.

I believe this is a simple fix here: https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/Util.java#L132-L140

The regex should be changed such that the '.' is optional and that the hostname/domain can have underscores '_'.

environment
Jenkins 2.89.2<br/>
Jenkins remoting 3.1.4<br/>
Jenkins swarm 3.7

Activity

  1. jenkins-infra-bot commented on Jan 3, 2018

    @jenkins-infra-bot
    Author
    ajhodges:
    • Original comment link
    • Raw content of original comment:

      Solution provided in JENKINS-32326 does not allow for simple hostnames in no_proxy

    Solution provided in JENKINS-32326 does not allow for simple hostnames in no_proxy

  2. jenkins-infra-bot commented on Jan 9, 2018

    @jenkins-infra-bot
    Author
    hdevos:
    • Original comment link
    • Raw content of original comment:

      I am encountering the same issue in same context : corporate proxy and need to connect the slave agent to my jenkins master with simple hostname (in a Docker environment)

    I am encountering the same issue in same context : corporate proxy and need to connect the slave agent to my jenkins master with simple hostname (in a Docker environment)

  3. jenkins-infra-bot commented on Jan 9, 2018

    @jenkins-infra-bot
    Author
    ajhodges:

    hdevos I'm not sure how close our setups are, but I did find a workaround. In a docker network you can append the stack/network name as a domain and it will resolve. For example .. Stack name did not work for me but network name did. Hope that helps as a workaround for this issue.

    Docs: https://docs.docker.com/docker-cloud/apps/service-links/#discovering-services-or-containers-on-another-stack

  4. jenkins-infra-bot commented on Jan 9, 2018

    @jenkins-infra-bot
    Author
    hdevos:
    • Original comment link
    • Raw content of original comment:

      ajhodges Thanks for your suggestion, i am deploying a basic docker-compose environment so unfortunately I don't have access to a stack name.

      My "workaround" is to use jenkins IP instead of simple hostname but my proxy configuration is now dirty and statically resolved before my agent launch 

    ajhodges Thanks for your suggestion, i am deploying a basic docker-compose environment so unfortunately I don't have access to a stack name.

    My "workaround" is to use jenkins IP instead of simple hostname but my proxy configuration is now dirty and statically resolved before my agent launch 

  5. jenkins-infra-bot commented on Jan 9, 2018

    @jenkins-infra-bot
    Author
    ajhodges:
    • Original comment link
    • Raw content of original comment:

      hdevos I just confirmed that I can ping <service_name>.<network_name> as well with a simple docker compose stack. The network name will be "<directory_name>_default" by default but you can verify by checking docker network ls

      Hope that works!

    hdevos I just confirmed that I can ping . as well with a simple docker compose stack. The network name will be "_default" by default but you can verify by checking docker network ls

    Hope that works!

  6. jenkins-infra-bot commented on Jan 9, 2018

    @jenkins-infra-bot
    Author
    hdevos:
    • Original comment link
    • Raw content of original comment:

      I wasn't aware of this, thanks Adam! In fact I declared a dedicated network to my compose stack, therefore my container "complete" address is <container_name>.<directory_name>_<network_name> 

    I wasn't aware of this, thanks Adam! In fact I declared a dedicated network to my compose stack, therefore my container "complete" address is ._ 

  7. jenkins-infra-bot commented on Jan 9, 2018

    @jenkins-infra-bot
    Author
    hdevos:

    Looks like there is another issue with this Util class:

    when using docker compose network dns adress : ._  (e.g: jenkins.test_mycomposenetwork), host does not match specified regexp in https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/Util.java#L132 

  8. jenkins-infra-bot commented on Jan 9, 2018

    @jenkins-infra-bot
    Author
    ajhodges:

    hdevos maybe try this to set a name without the directory name in there? https://docs.docker.com/compose/compose-file/compose-file-v2/#name-1

     

    I'll add the '_' to this issue.

  9. jenkins-infra-bot commented on Oct 24, 2018

    @jenkins-infra-bot
    Author
    jthompson:

    Here's a PR to re-work the no_proxy implementation: #293

    It should deal with this report and provide additional, new capabilities.

  10. jenkins-infra-bot commented on Dec 10, 2018

    @jenkins-infra-bot
    Author
    jthompson:
    • Original comment link
    • Raw content of original comment:

      This will be picked up by a Jenkins weekly build soon.

    This will be picked up by a Jenkins weekly build soon.

  11. jenkins-infra-bot commented on Nov 25, 2025

    @jenkins-infra-bot
    Author

    [Original relates_to from Jira: JENKINS-32326]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions