How the Zulus help you debug your web applications

The problem
Very often, debugging information requires a flag to be set server side, which isn’t practical once the product is delivered to the client. You can of course put a variable=value pair in the URL, but again that’s not practical, especially for XHR (Ajax) and POST requests. Then yes, there are cookies, but you need to know which one to use, with what data, and remember to take the cookie with you when you go on a support visit to the client, or put it on your Google Drive and hope the client machine you’ll put it on won’t be in a DMZ with no Internet access; in short . . . it’s full of uncertainty.
A simple solution
Zulu. Or rather the Zulu language, which you’ll set in your favourite browser on top of your usual preferred language. That way, the Accept-Language header your browser sends to a compliant website will look something like:
Accept-Language: en-au,fr;q=0.7,zu;q=0.3
All you then need to do is detect it in your code to make it display information not visible otherwise.
Now of course, since I’ve posted this on the Internet, everybody knows. It’s no longer a secret. As you’ll have gathered, getting back to secrecy is just one Zulu step away! All you need is to build a new, more custom preferred language string this time, with exotic characters, Zulu ones maybe, to reserve your own namespace on the web . . . e.g.
Accept-Language: fr;q=0.5,zumaisjeprefereuz123;q=0.5
To tell your browser to send a custom Accept-Language string with every request, you’ll need to refer to your browser’s documentation. There’s enough literature on the subject on the Internet for me not to repeat it here. However, I’ll give you the method for Firefox, as this page serves as my own reminder.
- Copy your current Accept-Language string into notepad or similar. There are many ways to find it, the simplest here being to go to the URL common.tropicalm.net/whats-my-accept-language.php
- Add Zulu to your browser via Options > Content > Languages > Choose, to prepare the ground, even if you want something less guessable than zu.
- Then go to the URL about:config in Firefox
- Right-click in the main window and create a new string general.acceptlanguage.override, with as its value the string copied in step 1, but modified to make zu harder to guess. For example zu123. Later on, you can try more elaborate and complicated character combinations.
- Save your changes and go back to the URL common.tropicalm.net/whats-my-accept-language.php to check your work.
Now that your browser is ready, you need to prepare the server side, by adding checkpoints to your code, wherever you like, that perform extended actions when they detect this exotic language.
Obviously this will depend on the language used. Here I’ll write some example checkpoints in PHP.
<?php
if (stripos($_SERVER['HTTP_ACCEPT_LANGUAGE'],'zu123') !== false) die(FirePHP(<whatever>, TRUE));
if (stripos($_SERVER['HTTP_ACCEPT_LANGUAGE'],'zu123') !== false) {
ini_set("display_errors",true);
error_reporting(E_ALL | E_STRICT);
}
?>
Generalising the principle
Now that you know the principle, your only limit will simply be your imagination. You can serve content suited to your needs simply by detecting a string hard-coded in these checkpoints. If you need many checkpoints, consider factoring them into a common function.The underlying principle here is simply: how can I make my web client unique, and how can I make my web application the unique lock that will work with the unique key my browser has become.


