A url or site like example.org which always produces a 404 error (and two for 200 and 204)
Posted by jpluimers on 2014/09/10
Yesterday I posted this question on StackOverflow and G+: Is there a url or site like example.org which always produces a 404 error?
Soon after that, I found out three links that produce predictable HTTP status codes:
They also work for https:
- 200: https://www.google.com
- 204: https://www.google.com/generate_204
- 404: https://www.google.com/404
Edit 20241223: these also return a 404: http://www.google.com/undefined and https://www.google.com/undefined
On StackOverflow very few people even noticed the question, probably wondering “why?”.
I’m using these links for positive and negative testing of some http / https handling code that needs to be good at coping with positive and negative responses.
In my testing life, I’ve learned the hard way that both negative and positive tests are core part of your suite, hence the question.
–jeroen
via: Is there a url or site like example.org which always produces a 404 error?.
Question
The example.org domain is for documentation purposes and a http request always resolves to it, so you get a HTTP 200 (OK) status code which means it can be used for positive testing.
Is there a URL for which it is known to always 404 that can be used for negative testing?
Answer
Studio 404si has posted links to a few pages of which the Google 404 actually gives a 404 http status code:
I found another page on Google that generates a status code, so I suspect there are more.
This one returns HTTP 204 (No Content) status code:
And of course the main site returns HTTP 200 (OK):






Leave a comment