2

I am working behind a company proxy and I set up a Dashboard using some frameworks. The Dashboard is running in a Docker container. The backend for requests against 3rd party components is handled by Ruby jobs.

With one job I try to connect from my Dashboard (which stands behind the proxy) to a Jenkins component (which is outside of the company). And I want to pass the proxy with nil, so that the Dashboard can grab some information from Jenkins.

Here is the code for the connection:

require 'net/http'
require 'json'           

JENKINS_URI = "XXX.XXX.XXX.XX:8080"
JENKINS_AUTH = {
}

def getFromJenkins(path)
  req_options = {
    proxy_address = nil,
    proxy_port = nil,
  }

  uri = URI.parse(path)
  http = Net::HTTP.new(uri.host, uri.port, req_options, proxy_address, 
  proxy_port)
  request = Net::HTTP::Get.new(uri.request_uri)
  if JENKINS_AUTH['name']
    request.basic_auth(JENKINS_AUTH['name'], JENKINS_AUTH['password'])
  end
  response = http.request(request)

  json = JSON.parse(response.body)
  return json
end

I already tried to filter some packets from the Jenkins server with tcpdump listening on port 8080 but no results there.

Holger Just
  • 52,918
  • 14
  • 115
  • 123
xFuture
  • 326
  • 1
  • 8

0 Answers0