I'm using Arduino Uno and ESP8266 in a project.

I'm using AT Commands to connect to wi-fi and make a request. I'm using the monitor serial to test the code before compile it in arduino.

It is connecting to wi-fi and I can make a request to a server in my network but when i try to make a request to my web-service in cloud it doesn't work well.

The return is an HTML with an 404 page instead of what I am expecting:

<h1>Hello Versa</h1>

Here is my code:

GET /webservice/

Can someone help me telling me what I am doing wrong?

After see the answer of Maximilian Gerhardt, I solved it writing the following sequence in the monitor serialize:

GET /webservice/ HTTP/1.1
Host: ternary.com.br
Connection: Close
[Just press enter and send a new line]
  • 2
    what does the response code 404 mean? – jsotola May 11 '18 at 0:58
  • An html page with saying "page not found" – Ricardo Godoz May 11 '18 at 10:50

A HTTP requests is comprised of more than just GET /webservice/. Take a look at what curl (console-line HTTP client) does.

C:\>curl -v "http://ternary.com.br/webservice/"
*   Trying
* Connected to ternary.com.br ( port 80 (#0)
> GET /webservice/ HTTP/1.1
> Host: ternary.com.br
> User-Agent: curl/7.46.0
> Accept: */*
< HTTP/1.1 200 OK
< Date: Fri, 11 May 2018 15:04:16 GMT
< Server: Apache
< X-Powered-By: PHP/5.6.30
< Vary: Accept-Encoding
< Cache-Control: max-age=0, no-cache, no-store, must-revalidate
< Expires: Wed, 11 Jan 1984 05:00:00 GMT
< X-UA-Compatible: IE=Edge,chrome=1
< Pragma: no-cache
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=UTF-8
<h1>Hello Versa</h1>* Connection #0 to host ternary.com.br left intact

You will have to at least transfer the minimal correct HTTP Headers of the form

GET /webservice/ HTTP/1.1
Host: ternary.com.br
Connection: Close

To get an answer. Also mind the ending \r\n\r\n. Refer to this website for more headers.

When I only send GET /webservice/ I also get 404 page.

C:\>cat test
GET /webservice/

C:\>cat test | ncat ternary.com.br 80
        <title data-i18n="[html]404_page.title">404 ÔÇô P├ígina n├úo encontrada</title>
  • Thank you so much! I solved it using these headers with HTTP/1.1 – Ricardo Godoz May 13 '18 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.