BACKGROUND:
AdTech & AdOps face many difficulties when managing ad delivery on their sites.
When everything works fine all is good, but the internet can and will throw curve balls that can be hard to replicate or reproduce.
We take for granted that services are up 24/7 and they always behave as expected. But when the unexpected happens this can often be hard to trace and debug the causes.
Slow loading images, non responsive servers and unexpected HTTP error codes can often cause failure in the adstack. eg; how do you ensure your stack still works if a critical component fails to load or impacts UX by blocking JS.
The most frequent issues we face are handling slow responding servers and servers that throw 4xx and 5xx errors. 
This is why I've written this tool. With it you can force specific scenarios such as 404 or 500 errors, malformed/broken payloads as well as being able to force delayed/slow responses. All determined dynamically through url params.


Accepted URL Params:
 delay   = how long to delay the rsponse for in  milliseconds (default = none)
 type    = type of response, choose from: type=image, type=http (requires a code param below),  
 code    = use when the typre is set to 'http'... this takes he http error response ncode eg; 200, 404, 500 etc...
 payload = payload
           if type=url this should be a URL (encoded if it has it's own url params)
           when I get round to supporting js/json/html this is where you'd add that code to return


USE CASES:


URLS:
Delay (3s) loading of a 3rd party URL eg; https://www.googletagservices.com/tag/js/gpt.js
https://www.rootsquare.com/?delay=3000&type=url&payload=https://www.googletagservices.com/tag/js/gpt.js
if you need to pass urlparams on the redirect endpoint you must encode the URL eg;
https://www.rootsquare.com/?delay=3000&type=url&payload=https%3A%2F%2Fwww.googletagservices.com%2Ftag%2Fjs%2Fgpt.js%3Ffoo%3Dbar%26bar%3Dfoo

Works be waiting 3000ms before issuing a 302 to the url passed in the 'url' param
This is a great way to test the impact of slow servers on your site, we use this extensively to test how our stack handles timeouts from tings like Prebid.


HTTP CODES
"What happens if their servers/service are having issues eg; 5xx or 4xx errors?"
AdTech systems are designed to be always available and the likelihood of them going offline or returning unexpected responses is, thankfully, very rare.
However it does happen. Over the 20+ years I've been in this industry all of our various SAAS systems have experienced outages and other unexpected issues.
Ensuring your stack can still handle such situations can be very difficult and frankly life is too short to sit there hitting F5 on the chance you might replicate an issue
Using the 'type=http' and 'code=xxx' options will allow you to recreate specific scenarios such as missing files, or internal server errors.

Force a 404 HTTP Error:
https://www.rootsquare.com/?type=http&code=404

Force a 500 HTTP Error:
https://www.rootsquare.com/?type=http&code=500

Force a slow response 500 HTTP Error (5s):
https://www.rootsquare.com/?type=http&code=500&delay=5000




IMAGES:
Return simple 1x1 images, when employed with the 'delay' option helps you identify potential performance bottlenecks.
The type param takes either 'gif' or 'png' as argument, the returned image is a 1x1 transparent image.

GIF:
https://www.rootsquare.com/?type=gif
Add a 5s delay to the server reponse
https://www.rootsquare.com/?type=gif&delay=5000

PNG:
https://www.rootsquare.com/?type=png
Add a 5s delay
https://www.rootsquare.com/?type=png&delay=5000



FUTURE SUPPORT:
I'm working on adding support to return arbitrary Javascript, JSON and HTML. However, this poses a number of security issues, especially in relation to JS.
A work around in the meantime would be for you to host any payload code on your own servers and use the "type=url&payload=https://yourserver/code" method to load into a page.