Last active
March 30, 2018 23:00
-
-
Save jviveiros/389374ec4b8aa3334dd313e467a1d1ff to your computer and use it in GitHub Desktop.
Ruby Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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