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

Need a way to specify proxy host and proxy port #33

Open
starrychloe opened this issue Oct 20, 2018 · 2 comments
Open

Need a way to specify proxy host and proxy port #33

starrychloe opened this issue Oct 20, 2018 · 2 comments

Comments

@starrychloe
Copy link

I'd like to specify Fiddler as a proxy so I can inspect the requests and responses easier. I need to specify localhost:7777 as a proxy. However, this doesn't allow proxy parameters, even though Net::HTTP does. The docs say you can provide a http: {} hash but the options to the linked method are only about certificates. The proxy host and proxy port are given by the 3rd and 4th arguments, and you can't specify them via a hash of options.

https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html#start-method

@axvm
Copy link

axvm commented Dec 22, 2018

Implemented proxy support in my fork
https://github.com/axvm/rails-reverse-proxy

How to use:

reverse_proxy 'https://google.com', headers: { Host: 'google.com' }, proxy: { host: '127.0.0.1', port: 8888 } do
  # implement here your callbacks
end

@semaperepelitsa
Copy link

If you want to use this proxy for the whole app, it might be easier to use "http_proxy" environment variable, since it is automatically picked up by Net::HTTP and other networking libraries.

export http_proxy=localhost:7777

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

3 participants