Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Development Tools HTTP Basics Introduction to HTTP Sending Data with a POST Request

503 Service Unavailable any suggestion?

When i make HTTP request it tells me the following:

First, this is the request:

$ telnet httpbin.org 80
Trying 50.16.250.54...
Connected to httpbin.org.
Escape character is '^]'.
POST /post HTTP/1.1
Host: httpbin.org
Content-Length: 32

firstname=hamza&language=English

Response:

HTTP/1.1 503 Service Unavailable
Connection: keep-alive
Server: Cowboy
Date: Fri, 02 Mar 2018 14:40:10 GMT
Content-Length: 506
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache, no-store

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta charset="utf-8">
    <title>Application Error</title>
    <style media="screen">
      html,body,iframe {
        margin: 0;
        padding: 0;
      }
      html,body {
        height: 100%;
        overflow: hidden;
      }
      iframe {
        width: 100%;
        height: 100%;
        border: 0;
      }
    </style>
  </head>
  <body>
    <iframe src="//www.herokucdn.com/error-pages/application-error.html"></iframe>
  </body>
</html>Connection closed by foreign host.

I did the same as the teacher did and unfortunately i got a server error 500. Am i missing something obvious ? any suggestion ? please^^.

1 Answer

Steven Parker
Steven Parker
218,596 Points

Try again? I cut your message and pasted it directly into my telnet, and I got a different response:

HTTP/1.1 200 OK
Connection: keep-alive
Server: meinheld/0.6.1
Date: Fri, 02 Mar 2018 15:26:20 GMT
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
X-Powered-By: Flask
X-Processed-Time: 0
Content-Length: 284
Via: 1.1 vegur

{
    "args": {},
    "data": "firstname=hamza&language=English",
    "files": {},
    "form": {},
    "headers": {
        "Connection": "close",
        "Content-Length": "32",
        "Host": "httpbin.org"
    },
    "json": null,
    "origin": "123.123.123.123",
    "url": "http://httpbin.org/post"
}

(actual origin IP replaced with 123's)

Yes! It works now. I tried the same way before (several times) but it didn't work. I am wondering If the location affects the connectivity to the server ? Because i was in the village when doing the request.