Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore ENV['no_proxy'] while initializing the connection #487

Closed
cosmtrek opened this issue Jun 6, 2015 · 2 comments
Closed

Ignore ENV['no_proxy'] while initializing the connection #487

cosmtrek opened this issue Jun 6, 2015 · 2 comments
Labels

Comments

@cosmtrek
Copy link

cosmtrek commented Jun 6, 2015

Consider this scenario: When ENV['http_proxy'] and ENV['no_proxy'] are set in my zsh config file, faraday always fires a request via proxy even this request should not go with proxy.

Specifically, I have set ENV variables as follows:

# zsh.rc
export http_proxy=http://127.0.0.1:10240/
export HTTPS_PROXY=$http_proxy
export NO_PROXY='127.0.0.1, localhost'

If I get the request http://localhost:3000, faraday should not go with proxy.

I read faraday's source code and hack it as follows:

# lib/faraday/connection.rb line 83
proxy(options.fetch(:proxy) {
  uri = ENV['http_proxy']
  if uri && !uri.empty?
    uri = 'http://' + uri if uri !~ /^http/i
    no_proxy = ENV['no_proxy'].gsub(/\s+/, '').split(',')
    u = URI(uri)
    no_proxy.include?(u.hostname) ? nil : uri
  end
})
@raphox
Copy link

raphox commented Jul 31, 2015

Duplicate of #471

@iMacTia iMacTia added the bug label Nov 8, 2016
@iMacTia
Copy link
Member

iMacTia commented Dec 29, 2016

This is being addressed in #637

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants