View Full Version : Adding HTTP Headers to Direct Requests

28 Aug 2009, 8:44 AM
Anyone know if it's possible to add HTTP headers to a Direct Request? I know it can be done to AJAX requests but after flipping through the source I couldn't find how it can be done for Direct requests. Any suggestions?


28 Aug 2009, 9:17 AM
Figured it out. Once again the Ext team made it so easy that I completely overlooked it. :)

Since Ext.Ajax is a singleton and Direct relies on Ext.Ajax, HTTP headers can be added directly to Ext.Ajax either by the defaultHeaders param:

Ext.Ajax.defaultHeaders = {
'Powered-By': 'Ext'

Or during the firing of an event like 'beforerequest', etc.

10 Jun 2013, 5:24 AM
Hello everyone, I have been searching for 4 days already how to add headers to Ext.direct method requests. I tried what is written in this thread but I could not see desired header in developer tools network tab. Here is my Ext js code.
Ext.Ajax.defaultHeaders = { "Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE"
Ext.ComponentQuery.query('panel')[6].setHtml('<span style="font-size: 28px">'+a+'</span>');
}); can you help me? Thank you.