Sometimes, when using a proxy server like the ones provided in CloudFlare, Amazon or any other CDN providers, you need to make sure that the service is properly intercepting the http errors and performing the right actions.

Usually, these services can handle 5xx errors coming from your Origin server, but how you can simulate these errors without doing something evil on your server.

Here is the script that you may use to simulate errors

How does it works?

Well, it’s really simple, at first, I’m not using a GET parameter to trigger a different error code, but using a Header variable GIVEMEERROR, by sending this on the request header, we can trigger a different HTTP error by just changing its value.

Example #1

As you can see, I’m sending the variable as part of the HTTP Request, so PHP will be able to catch it via $_SERVER[“HTTP_GIVEMEERROR”]. In this case I’m generating an Internal Server Error without doing something nasty in my server.

So far, I was able to use this script to test Custom Error Page redirections in NGINX servers and Apache2, feel free to use this script to test any HTTP error handler that you may know.

Follow me

Carlos Alberto Umanzor Arguedas

Web Developer at carlosumanzor.com
Web Developer, QA Engineer and Gamer Enthusiast, Developer of Linkcrawler and Father of a future computer ninja.
Follow me

 

 

Pin It on Pinterest

Shares
Share This
Optimization WordPress Plugins & Solutions by W3 EDGE