Setting the proxy server for RoR application

Patrick
Tue, 17 Jul 2007 10:37:33 -0000

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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---