0

Example:
The ruby script "TwitterConverter.rb" connects to the twitter api and subscribes to the TwitterStream.

Problem:
The script runs on a local Windows machine that sits behind a corporate proxy. Hypothetically, the script doesn't support proxy configuration.

What I've tried so far
1. I ran the script on my notebook, with the proxy disabled - the script worked fine
2. I've researched on the topic "How to start a ruby script with proxy" - without any success
3. I've set the environment variables correctly (http_proxy, https_proxy, both lower- and uppercase. https://user:pw@proxy.domain.com:port)

Question:
How can I start a ruby script with a proxy? The solution should be within the code. (Solutions for Windows settings are appreciated, but off-topic)

toxerli
  • 17
  • 8
  • This looks like a duplicate of https://stackoverflow.com/q/15792999/2230115 to me. Do the answers there answer your question? – iCodeSometime Jan 10 '20 at 20:18
  • Isn't that only for Net::HTTP? I need something that works for all Gems. @iCodeSometime – toxerli Jan 13 '20 at 07:32
  • It's not really possible to have something that works for all gems. A gem can work however the author wants. They could even even compile their own networking code from C, or shell out to the command line and use curl or similar – iCodeSometime Jan 13 '20 at 14:48
  • It sounds like what you might be looking for is a transparent proxy. This runs at a deeper level than other proxies, and will force all network traffic to go through the proxy without any application specific settings https://docs.mitmproxy.org/stable/howto-transparent/ – iCodeSometime Jan 13 '20 at 14:54

0 Answers0