# Http#get return 404 error

**URL:** <https://www.ruby-forum.com/t/http-get-return-404-error/63263>\
**Category:** Ruby\
**Created:** [June 13, 2006, 6:03pm UTC](https://www.ruby-forum.com/t/http-get-return-404-error/63263 "2006-06-13T18:03:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lian\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a698b9/32.png) [@Lian\_Y](https://www.ruby-forum.com/u/Lian_Y)\
**Post date:** [June 13, 2006, 6:03pm UTC](https://www.ruby-forum.com/t/http-get-return-404-error/63263/1 "2006-06-13T18:03:16Z")

</div>

Hi,

I tried to use

http#get(“[About the MLA | Modern Language Association](http://www.mla.org/about)”)

to obtain the page, but it returns a 404 error. However, using browser  
works fine.

I guess the server uses “struts” or similar framework. Would anyboby  
tell me how to solve this problem.

Regards

Lian

---

<div class="post-metadata">

**Author:** ![Lian\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a698b9/32.png) [@Lian\_Y](https://www.ruby-forum.com/u/Lian_Y)\
**Post date:** [June 13, 2006, 6:22pm UTC](https://www.ruby-forum.com/t/http-get-return-404-error/63263/2 "2006-06-13T18:22:46Z")

</div>

> > > > > “L” == Lian Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

L\> I guess the server uses “struts” or similar framework. Would anyboby  
L\> tell me how to solve this problem.

Just display the page which is given and you’ll see that it’s the same  
than  
the page retrieved by your browser

Guy Decoux

---

<div class="post-metadata">

**Author:** ![Lian\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a698b9/32.png) [@Lian\_Y](https://www.ruby-forum.com/u/Lian_Y)\
**Post date:** [June 13, 2006, 6:45pm UTC](https://www.ruby-forum.com/t/http-get-return-404-error/63263/3 "2006-06-13T18:45:09Z")

</div>

> > > > > “J” == Jacob F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

J\> I do, however, find it odd that trying to use wget does indeed result  
in  
J\> a 404:

The server returns 404 : just ignore it 🙂

Guy Decoux

---

<div class="post-metadata">

**Author:** ![Lian\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a698b9/32.png) [@Lian\_Y](https://www.ruby-forum.com/u/Lian_Y)\
**Post date:** [June 13, 2006, 6:41pm UTC](https://www.ruby-forum.com/t/http-get-return-404-error/63263/4 "2006-06-13T18:41:55Z")

</div>

On 6/13/06, Lian Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I tried to use
> 
> http#get(“[About the MLA | Modern Language Association](http://www.mla.org/about)”)
> 
> to obtain the page, but it returns a 404 error. However, using browser  
> works fine.

Like Guy, I’m able to get the page as so[1]:

require ‘net/http’  
require ‘uri’

url = URI.parse(‘[About the MLA | Modern Language Association](http://www.mla.org/about)’)  
res = Net::HTTP.start(url.host, url.port) {|http|  
http.get(‘/index.html’)  
}  
puts res.body

I do, however, find it odd that trying to use wget does indeed result in  
a 404:

$ wget [About the MLA | Modern Language Association](http://www.mla.org/about)  
–10:52:42-- [About the MLA | Modern Language Association](http://www.mla.org/about)  
=\> `about’  
Resolving [www.mla.org](http://www.mla.org)… 209.11.11.22  
Connecting to www.mla.org|209.11.11.22|:80… connected.  
HTTP request sent, awaiting response… 404 Not found  
10:52:43 ERROR 404: Not found.

Odd, that.

Jacob F.

[1] I wasn’t sure what “http#get” you were referring to, so I chose  
the most applicable example from the net/http documentation, net/http  
being part of the standard library. If this doesn’t match your usage,  
please explain more about which library you are using, particularly  
with a code example.
