Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
229,608 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.