I'd like to do something similar to what Google/Facebook do in this post: Why does Google prepend while(1); to their JSON responses?
Adding while(1);
to the beginning of script and json posts, using Rack middleware in a rails app. This way we can go back to doing ajax GET requests (which may or may not have an authentity_token or or sensitive data embedded in the response).
We also have an API which needs to not use this, so I am thinking some url matching where the middleware does not kick in.
Can anyone point me in the right direction what this code might look like? Thanks!