cf CLI fails when used through http proxy

1,655 views
Skip to first unread message

Guillaume Berche

unread,
Jun 19, 2013, 11:30:02 AM6/19/13
to vcap-dev

Trying to use cf through a proxy, I’m getting the following error. Weird that the initial CC API request goes through but apparently not the UAA's one. Any Idea ?

 

C:\code\cf_aprl_2013\vcap-java-client\cloudfoundry-client-lib\target\generated-test-resources>cf -t --debug --http-proxy http://127.0.0.1:3128 --https-proxy=http://127.0.0.1:3128 login

target: http://api.run.pivotal.io

 

>>> 

REQUEST: GET http://api.run.pivotal.io/info

REQUEST_HEADERS:

  Accept : application/json

  Content-Length : 0

RESPONSE: [200]

RESPONSE_HEADERS:

  age : 0

  cache-control : proxy-revalidate

  connection : Keep-Alive

  content-length : 258

  content-type : application/json;charset=utf-8

  date : Wed, 19 Jun 2013 15:05:33 GMT

  proxy-connection : Keep-Alive

  server : nginx

  x-frame-options : sameorigin

  x-vcap-request-id : afe1d1d9-e9ba-4302-96bd-e4ae95377c77

  x-xss-protection : 1; mode=block

RESPONSE_BODY:

{

  "name": "vcap",

  "build": "2222",

  "support": "http://support.cloudfoundry.com",

  "version": 2,

  "description": "Cloud Foundry sponsored by Pivotal",

  "authorization_endpoint": "https://login.run.pivotal.io",

  "token_endpoint": "https://uaa.run.pivotal.io",

  "allow_debug": true

}

<<< 

CF::UAA::BadTarget: error: getaddrinfo: Hote inconnu.

For more information, see ~/.cf/crash

c:/RubyHome/gems/cf-uaa-lib-1.3.10/lib/uaa/http.rb:161:in `rescue in net_http_request': error: getaddrinfo: H¶te inconnu

.  (CF::UAA::BadTarget)

        from c:/RubyHome/gems/cf-uaa-lib-1.3.10/lib/uaa/http.rb:141:in `net_http_request'

        from c:/RubyHome/gems/cf-uaa-lib-1.3.10/lib/uaa/http.rb:129:in `request'

        from c:/RubyHome/gems/cf-uaa-lib-1.3.10/lib/uaa/http.rb:111:in `http_get'

        from c:/RubyHome/gems/cf-uaa-lib-1.3.10/lib/uaa/http.rb:81:in `json_get'

        from c:/RubyHome/gems/cf-uaa-lib-1.3.10/lib/uaa/misc.rb:58:in `server'

        from c:/RubyHome/gems/cfoundry-2.1.0/lib/cfoundry/uaaclient.rb:16:in `block in prompts'

        from c:/RubyHome/gems/cfoundry-2.1.0/lib/cfoundry/uaaclient.rb:127:in `wrap_uaa_errors'

        from c:/RubyHome/gems/cfoundry-2.1.0/lib/cfoundry/uaaclient.rb:15:in `prompts'

        from c:/RubyHome/gems/cfoundry-2.1.0/lib/cfoundry/concerns/login_helpers.rb:6:in `login_prompts'

        from c:/RubyHome/gems/cf-3.0.0/lib/cf/cli/start/login.rb:24:in `login'

        from c:/RubyHome/gems/mothership-0.5.1/lib/mothership/base.rb:66:in `run'

        from c:/RubyHome/gems/mothership-0.5.1/lib/mothership/command.rb:72:in `block in invoke'

        from c:/RubyHome/gems/mothership-0.5.1/lib/mothership/command.rb:86:in `instance_exec'

        from c:/RubyHome/gems/mothership-0.5.1/lib/mothership/command.rb:86:in `invoke'

        from c:/RubyHome/gems/mothership-0.5.1/lib/mothership/base.rb:55:in `execute'

        from c:/RubyHome/gems/cf-3.0.0/lib/cf/cli.rb:156:in `block (2 levels) in execute'

        from c:/RubyHome/gems/cf-3.0.0/lib/cf/cli.rb:163:in `save_token_if_it_changes'

        from c:/RubyHome/gems/cf-3.0.0/lib/cf/cli.rb:155:in `block in execute'

        from c:/RubyHome/gems/cf-3.0.0/lib/cf/cli.rb:101:in `wrap_errors'

        from c:/RubyHome/gems/cf-3.0.0/lib/cf/cli.rb:151:in `execute'

        from c:/RubyHome/gems/mothership-0.5.1/lib/mothership.rb:45:in `start'

        from c:/RubyHome/gems/cf-3.0.0/bin/cf:13:in `<top (required)>'

        from c:/RubyHome/bin/cf:23:in `load'

        from c:/RubyHome/bin/cf:23:in `<main>'

 

Gaston Ramos

unread,
Jun 19, 2013, 10:16:20 PM6/19/13
to vcap...@cloudfoundry.org
El Wed, 19 de Jun de 2013, a las 05:30:02PM +0200, Guillaume Berche dijo:
> Trying to use cf through a proxy, I’m getting the following error. Weird
> that the initial CC API request goes through but apparently not the UAA's
> one. Any Idea ?
>
Are you running cf command in a windows machine? I'm sure if
windows is supported.


--
“Any fool can write code that a computer can understand. Good
programmers write code that humans can understand. ” - Martin Fowler


+-------------------------------------+
Gastón Ramos
http://gastonramos.com.ar/
GNU/Linux Counter user #450312

James Bayer

unread,
Jun 20, 2013, 3:20:31 AM6/20/13
to vcap...@cloudfoundry.org
Looks like cfoundry explicitly uses the proxy in the HTTP client and since the UAA client gem was done by a separate team from cf and I don't think we had a proxy to test this with, you may be a guinea pig. 
https://github.com/cloudfoundry/cfoundry/blob/ebfd88716fe2ff1537c734c8a229f6608b830ef3/spec/cfoundry/rest_client_spec.rb#L296

However, a quick look at the uaa gem shows that it uses net/http:

Which says that it will use the env variable http_proxy if it is present:

Have you tried setting the http_proxy env variable?
--
Thank you,

James Bayer

Guillaume Berche

unread,
Jun 20, 2013, 8:01:14 AM6/20/13
to vcap...@cloudfoundry.org
Thanks a lot James for the hint. It finally worked after upgrading to ruby 2.0 to workaround case-insensivity of windows (cf http://www.ruby-forum.com/topic/4402400 ).  http://docs.cloudfoundry.com/docs/common/install_ruby.html does not mention the expected ruby version on windows, is ruby 2.0 recommended ?

C:\DevKit>ruby -v
ruby 2.0.0p195 (2013-05-14) [x64-mingw32]

C:\DevKit>set http_proxy=http://127.0.0.1:3128
C:\DevKit>set https_proxy=http://127.0.0.1:3128

C:\DevKit>cf --http-proxy http://127.0.0.1:3128 --https-proxy=http://127.0.0.1:3128 login
DL is deprecated, please use Fiddle
target: http://api.run.pivotal.io
Email>
 [...]

With 1.9.2 it did not work, the uaa gem did not pick up the env variables (upper case or lower case)

Guillaume.

James Bayer

unread,
Jun 20, 2013, 11:41:24 AM6/20/13
to vcap...@cloudfoundry.org
thanks for replying with the detailed config information. we'll get this in the docs and i'm glad we now have a known-to-work windows config for behind a proxy.

horacio....@gmail.com

unread,
Jun 21, 2013, 7:50:22 AM6/21/13
to vcap...@cloudfoundry.org
Hi all !

I have the same problem behind my corporate proxy... I use an Ubuntu 13.04 with Ruby 1.9.3, the http_proxy et https_proxy variables are set, and when I try to connect I get :

Errno::ENOENT: No such file or directory - getaddrinfo
For more information, see ~/.cf/crash


Same thing using the  --http-proxy and  --https-proxy options in the cf command line.

Not tried Ruby 2.0 yet, as it isn't in Ubuntu repositories. 

Thanks in advance for any clue :)

Horacio

On Thursday, June 20, 2013 9:20:31 AM UTC+2, James Bayer wrote:

James Bayer

unread,
Jun 21, 2013, 9:28:39 AM6/21/13
to vcap...@cloudfoundry.org

horacio, i recommend a platform neutral ruby tool like rbenv that is able to download and install ruby 2.0 for you. if ruby 2.0 worked around the proxy issue on windows, there is a good chance it will work on ubuntu too.

here is one that has been tried on ubuntu 10.04. note the comments for issues that still need to be worked around.
https://gist.github.com/jnx/1256593

here is a series of steps for 12.04:
http://www.stehem.net/2012/05/08/how-to-install-ruby-with-rbenv-on-ubuntu-12-04.html

once you have rbenv installed, then you can install an rbenv plugin like ruby-build that will download updated versions of ruby for you. https://github.com/sstephenson/ruby-build.

for example, on my system:

jamesbayer$ rbenv install -list
Available versions:
  1.8.6-p383
  1.8.6-p420
  1.8.7-p249
  1.8.7-p302
  1.8.7-p334
  1.8.7-p352
  1.8.7-p357
  1.8.7-p358
  1.8.7-p370
  1.8.7-p371
  1.9.1-p378
  1.9.1-p430
  1.9.2-p0
  1.9.2-p180
  1.9.2-p290
  1.9.2-p318
  1.9.2-p320
  1.9.3-dev
  1.9.3-p0
  1.9.3-p125
  1.9.3-p194
  1.9.3-p286
  1.9.3-p327
  1.9.3-p362
  1.9.3-p374
  1.9.3-p385
  1.9.3-p392
  1.9.3-p429
  1.9.3-preview1
  1.9.3-rc1
  2.0.0-dev
  2.0.0-p0
  2.0.0-p195
  2.0.0-preview1
  2.0.0-preview2
  2.0.0-rc1
  2.0.0-rc2
  2.1.0-dev
  jruby-1.5.6
  jruby-1.6.3
  jruby-1.6.4
  jruby-1.6.5
  jruby-1.6.5.1
  jruby-1.6.6
  jruby-1.6.7
  jruby-1.6.7.2
  jruby-1.6.8
  jruby-1.7.0
  jruby-1.7.0-preview1
  jruby-1.7.0-preview2
  jruby-1.7.0-rc1
  jruby-1.7.0-rc2
  jruby-1.7.1
  jruby-1.7.2
  jruby-1.7.3
  jruby-1.7.4
  maglev-1.0.0
  maglev-1.1.0-dev
  mruby-dev
  rbx-1.2.4
  rbx-2.0.0-dev
  rbx-2.0.0-rc1
  ree-1.8.6-2009.06
  ree-1.8.7-2009.09
  ree-1.8.7-2009.10
  ree-1.8.7-2010.01
  ree-1.8.7-2010.02
  ree-1.8.7-2011.03
  ree-1.8.7-2011.12
  ree-1.8.7-2012.01
  ree-1.8.7-2012.02
  topaz-dev

jamesbayer$ rbenv install 2.0.0-p195
Downloading ruby-2.0.0-p195.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.gz

...

then once the ruby is installed, then:

rbenv rehash

rbenv system 2.0.0-p195

ruby --version

let us know if this works please, we want to update our proxy instructions for everyone.

Horacio Gonzalez

unread,
Jun 21, 2013, 10:23:01 AM6/21/13
to vcap...@cloudfoundry.org
Thanks a lot for the instructions, and for the quick answer !

I followed the instructions, trying with Ruby 2.0.0 :

horacio@horacioXXXXXXX:$ ruby --version
ruby
2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]


And I still get the same error :

horacio@horacioXXXXXXX:$ cf login 
Errno::ENOENT: No such file or directory - getaddrinfo
For more information, see ~/.cf/crash

And in error file ~/.cf/crash I get :

cf-3.0.0/lib/cf/cli.rb:288:in `initialize'
cf-3.0.0/lib/cf/cli.rb:288:in `
new'
cf-3.0.0/lib/cf/cli.rb:288:in `sane_target_url'

cf
-3.0.0/lib/cf/cli.rb:309:in `client_target'
cf-3.0.0/lib/cf/cli.rb:377:in `
client'
cf-3.0.0/lib/cf/cli.rb:163:in `save_token_if_it_changes'

cf
-3.0.0/lib/cf/cli.rb:155:in `block in execute'
cf-3.0.0/lib/cf/cli.rb:101:in `
wrap_errors'
cf-3.0.0/lib/cf/cli.rb:151:in `execute'

mothership
-0.5.1/lib/mothership.rb:45:in `start'
cf-3.0.0/bin/cf:13:in `
<top (required)>'
/usr/local/bin/cf:23:in `load'

/usr/local/bin/cf:23:in `<main>

When not using proxy, it works, of course.

Any idea ?

Regards,

Horacio

James Bayer

unread,
Jun 21, 2013, 11:05:22 AM6/21/13
to vcap...@cloudfoundry.org
it looks like communicate with the uaa is what is failing when using a proxy.

the identity team is going to have to look into this.

Guillaume Berche

unread,
Jun 26, 2013, 11:05:27 AM6/26/13
to vcap...@cloudfoundry.org
Looks like the start phase in the cf push command is also not respecting the http_proxy env or options, and the cmd line option.

C:\...\local-test>cf push --http-proxy=http://127.0.0.1:3128 --https-proxy=http://127.0.0.1:3128 -t --debug

DL is deprecated, please use Fiddle
[...]
Name> simple-spring-app
[...]
Save configuration?> n
[...]
Uploading simple-spring-app... OK
Stopping simple-spring-app... OK

[...]
Starting simple-spring-app... OK

[...]
REQUEST: PUT http://api.run.pivotal.io/v2/apps/f7be4607-2c01-45f8-ae9f-744a572b6169?stage_async=true
[...]
RESPONSE_BODY:
... OK
SocketError: getaddrinfo: H?te inconnu.

For more information, see ~/.cf/crash
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:878:in `initialize': getaddrinfo: Hôte inconnu.  (SocketError)
        from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:878:in `open'
        from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
        from C:/Ruby200-x64/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
        from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:877:in `connect'
        from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
        from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:851:in `start'
        from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:582:in `start'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cfoundry-2.1.1/lib/cfoundry/baseclient.rb:101:in `stream_url'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cfoundry-2.1.1/lib/cfoundry/v2/client.rb:82:in `stream_url'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/cli/app/start.rb:55:in `stream_start_log'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/cli/app/start.rb:28:in `block in start'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/spacing.rb:40:in `block in spaced'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/spacing.rb:38:in `each'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/spacing.rb:38:in `spaced'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/cli/app/start.rb:17:in `start'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/base.rb:66:in `run'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:72:in `block in invok
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/manifests/plugin.rb:38:in `call'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/manifests/plugin.rb:38:in `wrap_with_optional_name'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/manifests/plugin.rb:18:in `block (2 levels) in <cla
ManifestsPlugin>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:82:in `instance_exec'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:82:in `block (2 level
in invoke'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:86:in `instance_exec'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:86:in `invoke'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/base.rb:73:in `invoke'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/cli/app/restart.rb:16:in `restart'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/base.rb:66:in `run'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:72:in `block in invok
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/manifests/plugin.rb:38:in `call'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/manifests/plugin.rb:38:in `wrap_with_optional_name'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/manifests/plugin.rb:18:in `block (2 levels) in <cla
ManifestsPlugin>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:82:in `instance_exec'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:82:in `block (2 level
in invoke'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:86:in `instance_exec'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:86:in `invoke'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/base.rb:73:in `invoke'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/cli/app/push/sync.rb:32:in `commit_changes'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/cli/app/push.rb:56:in `sync_app'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/cli/app/push.rb:46:in `push'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/base.rb:66:in `run'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:72:in `block in invok
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/manifests/plugin.rb:137:in `call'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/manifests/plugin.rb:137:in `block in create_and_sav
anifest'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/callbacks.rb:74:in `with_filters
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/manifests/plugin.rb:135:in `create_and_save_manifes
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/manifests/plugin.rb:75:in `wrap_push'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/manifests/plugin.rb:27:in `block in <class:Manifest
ugin>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:82:in `instance_exec'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:82:in `block (2 level
in invoke'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:86:in `instance_exec'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/command.rb:86:in `invoke'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership/base.rb:55:in `execute'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/cli.rb:156:in `block (2 levels) in execute'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/cli.rb:167:in `save_token_if_it_changes'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/cli.rb:155:in `block in execute'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/cli.rb:101:in `wrap_errors'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/lib/cf/cli.rb:151:in `execute'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership.rb:45:in `start'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cf-3.0.0/bin/cf:13:in `<top (required)>'
        from C:/Ruby200-x64/bin/cf:23:in `load'
        from C:/Ruby200-x64/bin/cf:23:in `<main>'

C:\...\local-test>cf --version

DL is deprecated, please use Fiddle
cf 3.0.0

C:\...\local-test>ruby -v
ruby 2.0.0p195 (2013-05-14) [x64-mingw32]

C:\...\local-test> set http_proxy
http_proxy=http://127.0.0.1:3128

C:\...\local-test>set https_proxy
https_proxy=http://127.0.0.1:3128

I've submitted an issue https://github.com/cloudfoundry/cf/issues/20

I haven't yet looked into the source to check if there is a workaround, any suggestion ?

Thanks in advance,

Guillaume.

legall....@gmail.com

unread,
Jul 2, 2013, 10:55:18 AM7/2/13
to vcap...@cloudfoundry.org
I was facing the same issue.
Not sure if I'm right but I found out something strange in the code. The function sane_target_url in cli.rb uses TCPSocket.new to verify the URL. 
As I was not sure this makes use of any proxy settings, I commented this line on ma installation (Windows / ruby 2 / cf 3.0.0).
This seems to fix the issue.
I only need to setup the http_proxy environment variable.
Every basic commands (targets, info, login, apps, ...) work fine.

Gaston Ramos

unread,
Jul 2, 2013, 11:37:47 AM7/2/13
to vcap...@cloudfoundry.org
El Tue, 02 de Jul de 2013, a las 07:55:18AM -0700, legall....@gmail.com dijo:
> I was facing the same issue.
> Not sure if I'm right but I found out something strange in the code. The
> function sane_target_url in cli.rb uses TCPSocket.new to verify the URL.

Hi, could you please uncomment that line, try again and send us
the error message? that would be helpful to improve the code,
the sane_target_url is trapping Errno::ECONNREFUSED exception
I'm wondering what's the exception that you are getting in
you error.

Thanks

francis...@gmail.com

unread,
Jul 2, 2013, 12:28:57 PM7/2/13
to vcap...@cloudfoundry.org
i'm testing with proxy settings in http_proxy and https_proxy variables and with the --http-proxy and --https-proxy options 
i'm behind authenticated proxy suplying credentials in the form http://user:pwd@host:port

without the comment i get this running $ cf  -t --debug target

/var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:288:in `initialize': Connection timed out - connect(2) (Errno::ETIMEDOUT)
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:288:in `new'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:288:in `sane_target_url'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:309:in `client_target'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:377:in `client'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:163:in `save_token_if_it_changes'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:155:in `block in execute'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:101:in `wrap_errors'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:151:in `execute'
from /var/lib/gems/1.9.1/gems/mothership-0.5.1/lib/mothership.rb:45:in `start'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/bin/cf:13:in `<top (required)>'
from /usr/local/bin/cf:19:in `load'
from /usr/local/bin/cf:19:in `<main>'

with  following configuration (i don't know why cf gem code is under 1.9.1 version)

$ sudo gem update
Updating installed gems
Nothing to update
$ ruby --version
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
$ gem --version
2.0.0



running with a comment in tha line i can execute $ cf target

but not $ cf target https://api.run.pivotal.io  , cause i get

/usr/lib/ruby/1.9.1/net/http.rb:762:in `initialize': Connection timed out - connect(2) (Errno::ETIMEDOUT)
from /usr/lib/ruby/1.9.1/net/http.rb:762:in `open'
from /usr/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
from /usr/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
from /usr/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from /usr/lib/ruby/1.9.1/net/http.rb:762:in `connect'
from /usr/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from /usr/lib/ruby/1.9.1/net/http.rb:744:in `start'
from /var/lib/gems/1.9.1/gems/cfoundry-2.3.0/lib/cfoundry/rest_client.rb:151:in `request_uri'
from /var/lib/gems/1.9.1/gems/cfoundry-2.3.0/lib/cfoundry/rest_client.rb:63:in `request'
from /var/lib/gems/1.9.1/gems/cfoundry-2.3.0/lib/cfoundry/baseclient.rb:91:in `request_raw'
from /var/lib/gems/1.9.1/gems/cfoundry-2.3.0/lib/cfoundry/baseclient.rb:86:in `request'
from /var/lib/gems/1.9.1/gems/cfoundry-2.3.0/lib/cfoundry/baseclient.rb:64:in `get'
from /var/lib/gems/1.9.1/gems/cfoundry-2.3.0/lib/cfoundry/baseclient.rb:60:in `info'
from /var/lib/gems/1.9.1/gems/cfoundry-2.3.0/lib/cfoundry/client.rb:26:in `block in new'
from /var/lib/gems/1.9.1/gems/cfoundry-2.3.0/lib/cfoundry/client.rb:26:in `tap'
from /var/lib/gems/1.9.1/gems/cfoundry-2.3.0/lib/cfoundry/client.rb:26:in `new'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli/start/target.rb:26:in `block in target'
from /var/lib/gems/1.9.1/gems/interact-0.5.2/lib/interact/progress.rb:98:in `with_progress'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli/start/target.rb:24:in `target'
from /var/lib/gems/1.9.1/gems/mothership-0.5.1/lib/mothership/base.rb:66:in `run'
from /var/lib/gems/1.9.1/gems/mothership-0.5.1/lib/mothership/command.rb:72:in `block in invoke'
from /var/lib/gems/1.9.1/gems/mothership-0.5.1/lib/mothership/command.rb:86:in `instance_exec'
from /var/lib/gems/1.9.1/gems/mothership-0.5.1/lib/mothership/command.rb:86:in `invoke'
from /var/lib/gems/1.9.1/gems/mothership-0.5.1/lib/mothership/base.rb:55:in `execute'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:156:in `block (2 levels) in execute'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:163:in `save_token_if_it_changes'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:155:in `block in execute'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:101:in `wrap_errors'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/lib/cf/cli.rb:151:in `execute'
from /var/lib/gems/1.9.1/gems/mothership-0.5.1/lib/mothership.rb:45:in `start'
from /var/lib/gems/1.9.1/gems/cf-3.0.0/bin/cf:13:in `<top (required)>'
from /usr/local/bin/cf:19:in `load'
from /usr/local/bin/cf:19:in `<main>'

legall....@gmail.com

unread,
Jul 3, 2013, 2:53:30 AM7/3/13
to vcap...@cloudfoundry.org
I confirm the exception is Errno::ETIMEDOUT when the line is NOT commented.

Additional update: push command does not work even when the line is commented. The same exception is raised after the starting phase successufuly completes:
Starting tlg01... OK
Errno::ETIMEDOUT: A connection at ...

legall....@gmail.com

unread,
Jul 3, 2013, 5:05:54 AM7/3/13
to vcap...@cloudfoundry.org, legall....@gmail.com
Below is the patch I applied to fix the issue on the push command.
The tweak is to set proxy parameters on Net::HTTP.start method

file: C:\Ruby200-x64\lib\ruby\gems\2.0.0\gems\cfoundry-2.3.0\lib\cfoundry\baseclient.rb

Starting line number 98:

    def stream_url(url, &blk)
      uri = URI.parse(url)
 
 # TLG PATCH to use proxy
 if ENV["http_proxy"]
   proxy = URI.parse(ENV["http_proxy"])
 proxy_host = proxy.host
 proxy_port = proxy.port
 end

   Net::HTTP.start(uri.host, uri.port, proxy_host, proxy_port) do |http|
 # END OF TLG PATCH
      # Net::HTTP.start(uri.host, uri.port) do |http|

Balachander Keelapudi

unread,
Aug 14, 2013, 3:38:18 PM8/14/13
to vcap...@cloudfoundry.org


The " use of a proxy server for handling cf requests " issue has been resolved and to the obtain this fix , please install or upgrade to the latest CF gem using ' gem update cf / gem install cf ' .


As Marie documented here : http://docs.cloudfoundry.com/docs/using/managing-apps/cf/index.html#proxy


 You can specify both --http-proxy and --https-proxy to ensure that all communication associated with a cf command can be completed via the proxy server.


For example, to run the cf apps command behind a proxy server, enter this command, substituting the appropriate URLs:

cf apps --http-proxy myproxy.myproxydomain:8080 --https-proxy myproxy.myproxydomain:443

If your proxy server requires a username and password, to run the cf apps command behind a proxy server, enter this command,substituting the appropriate URLs, your username, and your password:

cf apps --http-proxy myusername:mypassword@myproxy.myproxydomain:8080 --https-proxy username:password@myproxy.myproxydomain:443


thanks, 
Bala

Dr Nic Williams

unread,
Aug 14, 2013, 9:00:28 PM8/14/13
to vcap...@cloudfoundry.org, vcap...@cloudfoundry.org
Awesome Bala et al.
--
Dr Nic Williams
Stark & Wayne LLC - the consultancy for Cloud Foundry
http://starkandwayne.com
+1 415 860 2185
twitter: drnic

amol28k...@gmail.com

unread,
Aug 26, 2013, 11:24:36 AM8/26/13
to vcap...@cloudfoundry.org
I am facing same issue

E:\Ruby200\bin>cf target --http-proxy=http://amol_kulkarni:sd...@xxx.xxx.co.in:8080 --https-proxy=http://amo
l_kulkarni:sda...@xxx.xxx.co.in:8080 --debug -t api.run.pivotal.io

DL is deprecated, please use Fiddle
api.run.pivotal.io
Errno::ETIMEDOUT: A connection attempt failed because the connected party did not properly respond after a period of time, or
 established connection failed because connected host has failed to respond. - connect(2)
cat ~/.cf/crash # for more details
E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `initialize': A connection attempt failed because the conne
cted party did not properly respond after a period of time, or established connection failed because connected host has faile
d to respond. - connect(2) (Errno::ETIMEDOUT)
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `new'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `sane_target_url'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:346:in `client_target'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:414:in `client'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:194:in `save_token_if_it_changes'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:186:in `block in execute'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:122:in `wrap_errors'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:182:in `execute'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership.rb:45:in `start'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/bin/cf:16:in `<top (required)>'
        from E:/Ruby200/bin/cf:23:in `load'
        from E:/Ruby200/bin/cf:23:in `<main>'

E:\Ruby200\bin>


Can you please help here

Balachander Keelapudi

unread,
Aug 26, 2013, 3:53:06 PM8/26/13
to vcap...@cloudfoundry.org
Greetings!

Could you update your cf gem using " gem update cf " and then try again.

thanks, 
Bala

Balachander Keelapudi

unread,
Aug 26, 2013, 4:11:07 PM8/26/13
to vcap...@cloudfoundry.org
I believe you can also export the proxy settings as environment variables and not specify them each time.

export HTTP_PROXY=proxy.example.com:8888
export HTTPS_PROXY=proxy.example.com:8888

If your proxy server requires login credentials, then provide that as well.

For more information on exporting the proxy setting as environment variables in linux refer :https://wiki.archlinux.org/index.php/Proxy_settings

thanks,
Bala

Balachander Keelapudi

unread,
Aug 26, 2013, 4:31:02 PM8/26/13
to vcap...@cloudfoundry.org
If it still does not work, Let me know and i will reopen this bug with cloud foundry for you!


On Monday, August 26, 2013 8:24:36 AM UTC-7, amol kulkarni wrote:

Balachander Keelapudi

unread,
Aug 26, 2013, 5:21:01 PM8/26/13
to vcap...@cloudfoundry.org
Can you try to specify the complete URL of the target : http://api.run.pivotal.io

Instead of api.run.pivotal.io as seen below.

YAMANO Yuji

unread,
Aug 27, 2013, 2:03:37 AM8/27/13
to vcap...@cloudfoundry.org
Hmm, I didn't know URL without scheme doesn't work with proxy.

https://github.com/cloudfoundry/cf/blob/v5.2.0/lib/cf/cli.rb#L316

def sane_target_url(url)
unless url =~ /^https?:\/\//
begin
TCPSocket.new(url, Net::HTTP.https_default_port)
url = "https://#{url}"
rescue Errno::ECONNREFUSED, SocketError, Timeout::Error
url = "http://#{url}"
end
end

url.gsub(/\/$/, "")
end

On Mon, 26 Aug 2013 14:21:01 -0700 (PDT), Balachander Keelapudi <bkeel...@gopivotal.com> wrote:

> Can you try to specify the complete URL of the target : http://api.run.pivotal.io
>
> Instead of api.run.pivotal.io as seen below.
>
> E:\Ruby200\bin>cf target --http-proxy=http://amol_kulkarni:sd...@xxx.xxx.co.in:8080 --https-proxy=http://amo
> l_kulkarni:sda...@xxx.xxx.co.in:8080 --debug -t api.run.pivotal.io

--
YAMANO Yuji
OGIS-RI

amol kulkarni

unread,
Aug 27, 2013, 5:04:08 AM8/27/13
to vcap...@cloudfoundry.org
Hi,

I have set the proxy like

E:\Ruby200\bin>set http_proxy=http://amol_kulkarni:x...@xxx.yyy.co.in:8080

E:\Ruby200\bin>set https_proxy=http://amol_kulkarni:x...@xxx.yyy.co.in:8080
and tried following

E:\Ruby200\bin>gem update cf
Updating installed gems
Updating cfoundry
Fetching: cfoundry-4.3.6.gem (73728B)
Successfully installed cfoundry-4.3.6
Parsing documentation for cfoundry-4.3.6
Installing ri documentation for cfoundry-4.3.6
Installing darkfish documentation for cfoundry-4.3.6
Done installing documentation for cfoundry (23 sec).
Gems updated: cfoundry

E:\Ruby200\bin>cf target -t --debug http://api.run.pivotal.io

DL is deprecated, please use Fiddle
api.run.pivotal.io
Errno::ETIMEDOUT: A connection attempt failed because the connected party did not properly respond after a period of time, or
 established connection failed because connected host has failed to respond. - connect(2)
cat ~/.cf/crash # for more details
E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `initialize': A connection attempt failed because the conne
cted party did not properly respond after a period of time, or established connection failed because connected host has faile
d to respond. - connect(2) (Errno::ETIMEDOUT)
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `new'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `sane_target_url'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:346:in `client_target'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:414:in `client'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:194:in `save_token_if_it_changes'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:186:in `block in execute'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:122:in `wrap_errors'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:182:in `execute'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership.rb:45:in `start'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/bin/cf:16:in `<top (required)>'
        from E:/Ruby200/bin/cf:23:in `load'
        from E:/Ruby200/bin/cf:23:in `<main>'

E:\Ruby200\bin>


E:\Ruby200\bin>cf target -t --debug api.run.pivotal.io

DL is deprecated, please use Fiddle
api.run.pivotal.io
Errno::ETIMEDOUT: A connection attempt failed because the connected party did not properly respond after a period of time, or
 established connection failed because connected host has failed to respond. - connect(2)
cat ~/.cf/crash # for more details
E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `initialize': A connection attempt failed because the conne
cted party did not properly respond after a period of time, or established connection failed because connected host has faile
d to respond. - connect(2) (Errno::ETIMEDOUT)
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `new'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `sane_target_url'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:346:in `client_target'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:414:in `client'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:194:in `save_token_if_it_changes'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:186:in `block in execute'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:122:in `wrap_errors'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:182:in `execute'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership.rb:45:in `start'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/bin/cf:16:in `<top (required)>'
        from E:/Ruby200/bin/cf:23:in `load'
        from E:/Ruby200/bin/cf:23:in `<main>'

E:\Ruby200\bin>


Still same problem can you please let me now what else I need to try

amol kulkarni

unread,
Aug 27, 2013, 8:37:30 AM8/27/13
to vcap...@cloudfoundry.org
Hi,
Do you think this is a bug? I tried with option you mentioned.

amol kulkarni

unread,
Aug 28, 2013, 4:26:25 PM8/28/13
to vcap...@cloudfoundry.org
Hi all,

Please help here not sure what could be wrong. I checked with the proxy people but they say that the connection is happening directly and not routing through the proxy. Not sure what should be done to route id through the proxy or if some port needs to be opened any way in which this can be traced can you please help here . Thanks in advance


On Tuesday, 27 August 2013 11:33:37 UTC+5:30, Yuji Yamano wrote:

amol kulkarni

unread,
Aug 31, 2013, 5:02:10 PM8/31/13
to vcap...@cloudfoundry.org
Hi here I tried with following settings
Hi,

I have set the proxy like

E:\Ruby200\bin>set http_proxy=http://amol_kulkarni:x...@xxx.yyy.co.in:8080

E:\Ruby200\bin>set https_proxy=http://amol_kulkarni:x...@xxx.yyy.co.in:8080
and tried following

E:\Ruby200\bin>gem update cf
Updating installed gems
Updating cfoundry
Fetching: cfoundry-4.3.6.gem (73728B)
Successfully installed cfoundry-4.3.6
Parsing documentation for cfoundry-4.3.6
Installing ri documentation for cfoundry-4.3.6
Installing darkfish documentation for cfoundry-4.3.6
Done installing documentation for cfoundry (23 sec).
Gems updated: cfoundry

E:\Ruby200\bin>cf target -t --debug http://api.run.pivotal.io

DL is deprecated, please use Fiddle
api.run.pivotal.io
Errno::ETIMEDOUT: A connection attempt failed because the connected party did not properly respond after a period of time, or
 established connection failed because connected host has failed to respond. - connect(2)
cat ~/.cf/crash # for more details
E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `initialize': A connection attempt failed because the conne
cted party did not properly respond after a period of time, or established connection failed because connected host has faile
d to respond. - connect(2) (Errno::ETIMEDOUT)
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `new'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `sane_target_url'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:346:in `client_target'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:414:in `client'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:194:in `save_token_if_it_changes'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:186:in `block in execute'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:122:in `wrap_errors'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:182:in `execute'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership.rb:45:in `start'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/bin/cf:16:in `<top (required)>'
        from E:/Ruby200/bin/cf:23:in `load'
        from E:/Ruby200/bin/cf:23:in `<main>'

E:\Ruby200\bin>


E:\Ruby200\bin>cf target -t --debug api.run.pivotal.io

DL is deprecated, please use Fiddle
api.run.pivotal.io
Errno::ETIMEDOUT: A connection attempt failed because the connected party did not properly respond after a period of time, or
 established connection failed because connected host has failed to respond. - connect(2)
cat ~/.cf/crash # for more details
E:/Ruby200/lib/ruby/gems/2.0.
0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `initialize': A connection attempt failed because the conne
cted party did not properly respond after a period of time, or established connection failed because connected host has faile
d to respond. - connect(2) (Errno::ETIMEDOUT)
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `new'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `sane_target_url'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:346:in `client_target'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:414:in `client'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:194:in `save_token_if_it_changes'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:186:in `block in execute'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:122:in `wrap_errors'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:182:in `execute'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership.rb:45:in `start'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/bin/cf:16:in `<top (required)>'
        from E:/Ruby200/bin/cf:23:in `load'
        from E:/Ruby200/bin/cf:23:in `<main>'

E:\Ruby200\bin>

I need help in this regard what should be next steps , plz help, thanks for the reply earlier.

Balachander Keelapudi

unread,
Aug 31, 2013, 6:43:01 PM8/31/13
to vcap...@cloudfoundry.org
Hi Amol, 
The standard port for the https proxy is 443, as seen below i see that you are using the 8080 port for both http and https which i don't believe is correct. 
try this syntax:

cf apps --http-proxy myproxy.myproxydomain:8080 --https-proxy myproxy.myproxydomain:443

Balachander Keelapudi

unread,
Sep 1, 2013, 1:54:54 PM9/1/13
to vcap...@cloudfoundry.org
Hi Amol, 
Based on the error message below, I believe that this might be a network issue. Once the proxy settings are complete in your system, Can you test to see if any of your requests are going through the proxy server and verify if the proxy server is able to reach the internet. you can also try doing a  tcpdump or a wireshark capture to analyze the network traffic appropriately.
 
E:/Ruby200/lib/ruby/gems/2.0.
0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `initialize': A connection attempt failed because the conne
cted party did not properly respond after a period of time, or established connection failed because connected host has faile
d to respond. - connect(2) (Errno::ETIMEDOUT)

If none of these suggestions work, then i would recommend opening a bug report at https://github.com/cloudfoundry/cf/issues

thanks, 
Bala

amol kulkarni

unread,
Sep 2, 2013, 10:37:58 AM9/2/13
to vcap...@cloudfoundry.org
Hi Bala,
Thanks for reply I tried

E:\Ruby200\bin>cf target --http_proxy=amol_kulkarni:abc...@xx.xx.xx:8080 --https_proxy=amol_kulkarni:
abc...@xx.xx.xx.xx:443 api.run.pivotal.io --debug

DL is deprecated, please use Fiddle
api.run.pivotal.io
Errno::ETIMEDOUT: A connection attempt failed because the connected party did not properly respond after a period of time, or
 established connection failed because connected host has failed to respond. - connect(2)
cat ~/.cf/crash # for more details
E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `initialize': A connection attempt failed because the conne

cted party did not properly respond after a period of time, or established connection failed because connected host has faile
d to respond. - connect(2) (Errno::ETIMEDOUT)
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `new'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:325:in `sane_target_url'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:346:in `client_target'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:414:in `client'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:194:in `save_token_if_it_changes'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:186:in `block in execute'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:122:in `wrap_errors'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/lib/cf/cli.rb:182:in `execute'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/mothership-0.5.1/lib/mothership.rb:45:in `start'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/cf-5.2.0/bin/cf:16:in `<top (required)>'
        from E:/Ruby200/bin/cf:23:in `load'
        from E:/Ruby200/bin/cf:23:in `<main>'

E:\Ruby200\bin>

amol kulkarni

unread,
Sep 2, 2013, 11:09:32 AM9/2/13
to vcap...@cloudfoundry.org
Should I open a bug?


On Sunday, 1 September 2013 23:24:54 UTC+5:30, Balachander Keelapudi wrote:

Balachander Keelapudi

unread,
Sep 2, 2013, 11:51:19 AM9/2/13
to vcap...@cloudfoundry.org
Hi Amol,

As suggested in my previous comment, I would test to understand if the proxy setup is working before posting a bug. Here are a few test cases that you can try:

1. Try to ping ' google.com ' and check if you are getting a response.
2. Do a tra

" Based on the error message below, I believe that this might be a network issue. Once the proxy settings are set in your system, Can you test to see if any of your requests are going through the proxy server and verify if the proxy server is able to reach the internet. you can also try doing a tcpdump or a wireshark capture to analyze the network traffic appropriately.

Balachander Keelapudi

unread,
Sep 2, 2013, 12:03:05 PM9/2/13
to vcap...@cloudfoundry.org
Here are few more test cases to understand if the proxy setup is working correctly:
1. ping ' google.com' to verify if you have Internet connection
2. Do a trace route to ' google.com ' to understand if the requests go though the proxy
3. You can also do a TCP dump or a wireshark capture from the source to understand if the requests are being routed thro the proxy

I believe these steps will help you do a sanity check of your proxy setup and once all of this works then you can narrow down the issue to 'cf' and open a bug.

Thanks,
Bala

YAMANO Yuji

unread,
Sep 2, 2013, 10:59:28 PM9/2/13
to vcap...@cloudfoundry.org, amol28k...@gmail.com
On Mon, 2 Sep 2013 07:37:58 -0700 (PDT), amol kulkarni <amol28k...@gmail.com> wrote:

> E:\Ruby200\bin>cf target --http_proxy=amol_kulkarni:abc...@xx.xx.xx:8080
> --https_proxy=amol_kulkarni:
> abc...@xx.xx.xx.xx:443 api.run.pivotal.io --debug

I don't think proxy works with schemeless target URL like api.run.pivotal.io.
Could you try to use https://api.run.pivotal.io instead?

--
YAMANO Yuji
OGIS-RI

amol kulkarni

unread,
Sep 7, 2013, 4:42:45 AM9/7/13
to vcap...@cloudfoundry.org
Hi Bala,

Thanks for all your help I was able to run cf commands . The issue was with the network. cf uses the tcp connections
from windows machine but the firewall block these connections as a result I had to install the isa client which directly communicates using winsock with the proxy allowing the authentication. So in conclusion on windows you need to have ISA client installed for enabling the tcp connections route through the ISA proxy. Thanks for all your help.

YAMANO Yuji

unread,
Sep 12, 2013, 5:19:42 AM9/12/13
to vcap...@cloudfoundry.org
On Sat, 7 Sep 2013 01:42:45 -0700 (PDT), amol kulkarni <amol28k...@gmail.com> wrote:

> So in conclusion on windows you
> need to have ISA client installed for enabling the tcp connections route
> through the ISA proxy. Thanks for all your help.

cf 5.2.2 on Windows 7 works without the ISA proxy to me.
It looks David fixed the issue in the end of Aug.

--
YAMANO Yuji
OGIS-RI

Reply all
Reply to author
Forward
0 new messages