Skip to content

Instantly share code, notes, and snippets.

@jviveiros
Last active March 30, 2018 23:00
Show Gist options
  • Save jviveiros/389374ec4b8aa3334dd313e467a1d1ff to your computer and use it in GitHub Desktop.
Save jviveiros/389374ec4b8aa3334dd313e467a1d1ff to your computer and use it in GitHub Desktop.
Ruby Example
require 'faraday_middleware'
require 'faraday'
require 'json'
@username = ENV['FORWARD_HTTP_PROXY_USERNAME']
@password = ENV['FORWARD_HTTP_PROXY_PASSWORD']
@forward_proxy = ENV['FORWARD_HTTP_PROXY_HOST']
@reverse_proxy = ENV['REVERSE_HTTP_PROXY_HOST']
def reveal_via_forward_proxy(tokenized_data)
connection = Faraday.new(
:url => 'https://httpbin.verygoodsecurity.io',
:headers => {'Content-type' => 'application/json'},
:ssl => {:ca_file => './cert.pem'},
:proxy => "https://#{@username}:#{@password}@#{@forward_proxy}") do |f|
f.response :json
f.adapter Faraday.default_adapter
end
rsp = connection.post '/post', tokenized_data
rsp.body['data']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment