Using rails with proxy problem

i’m trying to tell rails to use a proxy, but i’m getting an error at the
command line, does anybody know what this means?

C:\InstantRails>gem install rails --include-dependencies --http-proxy
http://int
ernet.mywebsite.net:80
ERROR: While executing gem … (NoMethodError)
undefined method `[]=’ for #Gem::ConfigFile:0x27e758c

Matt Lawson wrote:

i’m trying to tell rails to use a proxy, but i’m getting an error at the
command line, does anybody know what this means?

C:\InstantRails>gem install rails --include-dependencies --http-proxy
http://int
ernet.mywebsite.net:80
ERROR: While executing gem … (NoMethodError)
undefined method `[]=’ for #Gem::ConfigFile:0x27e758c

While this is not an answer to your question, but it would appear
(unless it’s a huge coincidence) that you’re using InstantRails. If
that’s the case, rails is already installed.

Cheers
Mohit.

Mohit S. wrote:

Matt Lawson wrote:

i’m trying to tell rails to use a proxy, but i’m getting an error at the
command line, does anybody know what this means?

C:\InstantRails>gem install rails --include-dependencies --http-proxy
http://int
ernet.mywebsite.net:80
ERROR: While executing gem … (NoMethodError)
undefined method `[]=’ for #Gem::ConfigFile:0x27e758c

While this is not an answer to your question, but it would appear
(unless it’s a huge coincidence) that you’re using InstantRails. If
that’s the case, rails is already installed.

Cheers
Mohit.

yes rails is installed, i am needing to know how to use rails with a
proxy server

Matt Lawson wrote:

ERROR: While executing gem … (NoMethodError)

yes rails is installed, i am needing to know how to use rails with a
proxy server

Hi Matt,

The command that you are trying to use will install rails on your PC
when the PC is behind a proxy. I’m not sure what you mean by “use rails
with a prxoy server” - do you want a client behind a proxy server to
access your web content, or do you want your web application to be
served from a server behind a proxy. In both cases, the approach that
you’re taking will only install rails - it won’t do either of the 2
options I mentioned above.

Cheers
Mohit.

Mohit S. wrote:

Matt Lawson wrote:

ERROR: While executing gem … (NoMethodError)

yes rails is installed, i am needing to know how to use rails with a
proxy server

Hi Matt,

The command that you are trying to use will install rails on your PC
when the PC is behind a proxy. I’m not sure what you mean by “use rails
with a prxoy server” - do you want a client behind a proxy server to
access your web content, or do you want your web application to be
served from a server behind a proxy. In both cases, the approach that
you’re taking will only install rails - it won’t do either of the 2
options I mentioned above.

Cheers
Mohit.

I guess i need to clarify a little…

I have a rails application that uses http/https to read/write to a
database through an API, and it works fine when i’m at home, but not
when i’m at work (behind corporate firewall).

i’m needing to know how to get this application to work behind the
firewall…

Matt Lawson wrote:

I guess i need to clarify a little…

I have a rails application that uses http/https to read/write to a
database through an API, and it works fine when i’m at home, but not
when i’m at work (behind corporate firewall).

i’m needing to know how to get this application to work behind the
firewall…

Any suggestions Mohit?

Matt Lawson wrote:

firewall…

Any suggestions Mohit?

(resend - I recd an error when I sent the mail the first time. Sorry if
you receive multiple copies)

Morning, Matt! Where is the database that you’re trying to reach? It
appears to me that your database is not running on the same PC as
InstantRails. So what seems to be happening is that your corporate
firewall is blocking Rails from accessing the database server. For
example, for MySQL, Ruby (Rails) typically needs to access port 3306.
It seems that your corporate firewall is blocking that. If that’s the
case, you probably need your IT guys to allow Ruby to access the remote
database server using the port.

Perhaps someone else can be of help?

Cheers
Mohit.

Mohit S. wrote:

Matt Lawson wrote:

firewall…

Any suggestions Mohit?

(resend - I recd an error when I sent the mail the first time. Sorry if
you receive multiple copies)

Morning, Matt! Where is the database that you’re trying to reach? It
appears to me that your database is not running on the same PC as
InstantRails. So what seems to be happening is that your corporate
firewall is blocking Rails from accessing the database server. For
example, for MySQL, Ruby (Rails) typically needs to access port 3306.
It seems that your corporate firewall is blocking that. If that’s the
case, you probably need your IT guys to allow Ruby to access the remote
database server using the port.

Perhaps someone else can be of help?

Cheers
Mohit.

Yes I am accessing a remote database through an API (basecamp actually).
When i try to run the application, i see the following ports being
blocked:

Proto Local Address Foreign Address State
TCP 127.0.0.1:1416 127.0.0.1:3000 TIME_WAIT
TCP 127.0.0.1:3000 127.0.0.1:1415 TIME_WAIT
TCP 127.0.0.1:3000 127.0.0.1:1417 TIME_WAIT
TCP 127.0.0.1:3000 127.0.0.1:1418 TIME_WAIT
TCP 127.0.0.1:3000 127.0.0.1:1419 TIME_WAIT

Matt Lawson wrote:

figured it out, thought i’d post the soluction for anyone else who might
proxy_port = 8080

Good to know, Matt.

Cheers
Mohit.

Matt Lawson wrote:

Mohit S. wrote:

Matt Lawson wrote:

firewall…

figured it out, thought i’d post the soluction for anyone else who might
read this thread.

To access documents via HTTP when a proxy server is required, use the
Net::HTTP::Proxy class.

example:

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
:
}

further reading:
http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs