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

[Correios::Frete] Correios-Frete Response: HTTP/1.1 407 Proxy Authentication Required #24

Open
Ronair opened this issue Jan 12, 2017 · 1 comment

Comments

@Ronair
Copy link

Ronair commented Jan 12, 2017

Problema: utilizar a gem em ambiente de desenvolvimento onde tem proxy.
Erro: " [Correios::Frete] Correios-Frete Response: HTTP/1.1 407 Proxy Authentication Required .... "
Solução: Adicionar no seu arquivo /config/environments/development.rb

module Correios
  module Frete
    class WebService
      def http_request(url)

        uri = URI.parse(url)
        request = Net::HTTP::Get.new(uri.request_uri)
        http = Net::HTTP.new(uri.host, uri.port)
        http.open_timeout = Correios::Frete.request_timeout

        http.proxy_address = 'ip_proxy'
        http.proxy_port = 'port'
        http.proxy_user = 'user'
        http.proxy_pass = 'password'

        http.request(request)
      end
    end
  end
end
@Ronair Ronair closed this as completed Jan 12, 2017
@prodis prodis reopened this Jan 12, 2017
@prodis
Copy link
Owner

prodis commented Jan 12, 2017

@Ronair
Thanks for expose your problem and share your fix. 👍
I will keep this issue opened until we have a root solution.

Could you help to implement support for proxy? 😉
We can have something similar to correios-cep gem: https://github.com/prodis/correios-cep#http-proxy

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

No branches or pull requests

2 participants