Assume I have a gwt app on a large website which sets a lot of cookies, and that I'm not in control of which cookies get set. Assume further that my gwt app makes a number of REST calls to a lightweight API within the same domain (as indeed one must do) using RequestBuilder
.
RequestBuilder
reasonably enough makes an HTTP request to the server, and sends all the cookies it has received. The problem with this is that the cookies themselves sometimes take over 90% of the request size.
Yes, it would be nice if the web site did not set so many cookies, but assume this is unfixable. No, deleting the cookies from the browser is not an option (it's fine if they are totally inaccessible to / hidden from the gwt application, for instance if I could somehow persuade the gwt app to use a separate empty cookie jar).
How do I persuade RequestBuilder
not to send any cookies?
Note solving this for XmlHttpRequest
and wrapping it up in GWT code would be fine.
Things I found that might be useful (in general for JS and not for GWT, but GWT ultimately uses XmlHttpRequest
):
- Cookie Monster: An observer that steals the cookies from
XmlHttpRequest
before the request is sent. I think this might be Firefox specific, and it seems a bit like hard work. yourXMLHttpReq.channel.loadFlags |= Ci.nsIRequest.LOAD_ANONYMOUS;
: this would be pretty much perfect, save it requires surgery to get it into GWT and I think its Firefox specific.- This question, which handles Chrome extensions, the answer to which is to either remove and readd all the cookies (does not work for a long-running app), or use an incognito window (I want this to only affect the REST API call).