returnco.de

This is a super simple service for generating different HTTP codes.

It's useful for testing how your own scripts deal with varying responses.

Just add the status code you want to the host name, like this: http://567.returnco.de

We'll return an empty response:

# curl -i http://567.returnco.de HTTP/1.1 567 X-returnco-de: 567 Content-Length: 0 Date: Sat, 10 Dec 2016 21:52:23 GMT Server: lighttpd

The status code can be specified in three ways:

host
The desired return code can be put into the host part of the request, as in http://567.returnco.de On the server side, this is read from the HTTP/1.1 "Host" header that's sent by all today's clients automatically.
port
It can be specified via the tcp port that you connect to, again identified via Host header, as in http://returnco.de:567
path
When you really can't or do not want to send a Host header, path-style requests like http://returnco.de/567 work here, too. Unfortunately, it is not possible to use a fragment (e.g. http://returnco.de/page#567), because fragments are client-side only and are not sent to the server.

The host and path options should work over both HTTP as well as HTTPS/TLS.

Kudos to the folks over at http://httpstat.us for inspiration plus page style and text content. Unlike their service, here you're not limited to just the path of the URI to provoke a specific response.

In practice, it can be much easier to just change the host name or port in your program's configuration rather than trying to get it to request a specific URI!

You can ask for any HTTP status code in the range of 200 to 999. Port tcp/443 is the default port for TLS, so for 443 host or path should be used. The complete list of HTTP/1.1 Status Codes can be found in RFC2616 Section 10. For convenience:

200
OK
201
Created
202
Accepted
203
Non-Authoritative Information
204
No Content
205
Reset Content
206
Partial Content
300
Multiple Choices
301
Moved Permanently
302
Found
303
See Other
304
Not Modified
305
Use Proxy
306
Unused
307
Temporary Redirect
308
Permanent Redirect
400
Bad Request
401
Unauthorized
402
Payment Required
403
Forbidden
404
Not Found
405
Method Not Allowed
406
Not Acceptable
407
Proxy Authentication Required
408
Request Timeout
409
Conflict
410
Gone
411
Length Required
412
Precondition Required
413
Request Entry Too Large
414
Request-URI Too Long
415
Unsupported Media Type
416
Requested Range Not Satisfiable
417
Expectation Failed
418
I'm a teapot
422
Unprocessable Entity
428
Precondition Required
429
Too Many Requests
431
Request Header Fields Too Large
451
Unavailable For Legal Reasons
500
Internal Server Error
501
Not Implemented
502
Bad Gateway
503
Service Unavailable
504
Gateway Timeout
505
HTTP Version Not Supported
511
Network Authentication Required
520
Web server is returning an unknown error
522
Connection timed out
524
A timeout occurred

Caveats / Bugs:

The HTTP server hosting this service is unable to handle Transfer-Encoding: chunked requests. This header is ignored. It expects that a Content-Length: ... header is present in all requests. Otherwise, HTTP 411 Length Required is returned instead of the requested return code.

In the URL, larger numbers are treated as (milli-) seconds and converted to YYYY-MM-DD'T'HH:MI:SS.SSS'Z' as plain body content (RFC3339): /1xxxxxxxx0" (seconds, 3-10 digits) to /1xxxxxxxxxxx9 (millseconds, 11-13 digits).

Enjoy!