Opened 11 years ago

Closed 10 years ago

Last modified 9 years ago

#14482 closed enhancement (fixed)

[patch] [cla] dojo/text without HTTP header "X-Requested-With"

Reported by: xMartin Owned by: Rawld Gill
Priority: high Milestone: 1.8
Component: Loader Version: 1.7.0
Keywords: Cc:
Blocked By: Blocking:


dojo.xhr sends an HTTP header "X-Requested-With: XMLHttpRequest" (#5801) to give servers a hint to send only partial HTML code as it is not a regular page request. Cross-domain xhr causes preflight request with this header (#9486) which can be prevented by setting this header to null. The loader plugin dojo/text uses dojo.xhr to retrieve text files like widget templates. It would be great if this worked cross-domain with CORS headers but it doesn't due to the preflight request.

Would it be reasonable to remove the header in the dojo/text plugin?

Patch attached, CCLA.

Attachments (1)

requested-with.patch.txt (434 bytes) - added by xMartin 11 years ago.

Download all attachments as: .zip

Change History (7)

Changed 11 years ago by xMartin

Attachment: requested-with.patch.txt added

comment:1 Changed 11 years ago by bill

Summary: dojo/text without HTTP header "X-Requested-With"[patch] [cla] dojo/text without HTTP header "X-Requested-With"

comment:2 Changed 10 years ago by Rawld Gill

Fixed in [27536].

In order to use the feature, set the headers desired for the text plugin like this (e.g.)

  dojoConfig = {

comment:3 Changed 10 years ago by Rawld Gill

Resolution: fixed
Status: newclosed

comment:4 Changed 10 years ago by bill

Milestone: tbd1.8

comment:5 Changed 10 years ago by xMartin

Works for me but in this case needs to be

textPluginHeaders: {"X-Requested-With": null}

comment:6 Changed 9 years ago by inghamc

Hey, This broke again when dojo/text.js was updated to use request instead of xhr

Submitted #17493 for the regression

Last edited 9 years ago by inghamc (previous) (diff)
Note: See TracTickets for help on using tickets.