Forum: Ruby on Rails Setting the proxy server for RoR application

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
50e91f1376175e329ac2f33da2cce4bc?d=identicon&s=25 Patrick (Guest)
on 2007-07-17 12:38
(Received via mailing list)
Hi ~

I written a RoR application that need to feed the web content using
web service or make a get or post request to another server. However
the RoR application server is located behind the proxy, so that if my
web broswer need to get a homepage, it need to set the proxy host and
port in the browser before to use. But for my RoR application, how can
it know that their have a proxy server, so that the application can
correctly get the web content?

I did research on some forums, and i always said that use the
following code that also appear in the ruby documentation

  require 'net/http'

    proxy_addr = 'your.proxy.host'
    proxy_port = 8080
            :
    Net::HTTP::Proxy(proxy_addr, proxy_port).start('www.example.com')
{|http|
      # always connect to your.proxy.addr:8080
            :
    }

Is there have another general way (i mean the proxy setting can apply
to whole RoR application without changing the code) to set the proxy
setting for RoR application? Can it be set in the environment file?

Thank ~
Patrick
This topic is locked and can not be replied to.