If you are using CKEditor version 4.9 +
then there is one way you can do this.
I faced the same problem while working, so after some search and trying some code samples I found the way.
There are some configurations that you have to set,
again I repeat this is for CKEditor version 4.9 +
.
set below configuration in your ckeditor config object
{
filebrowserUploadUrl : 'your upload path goes here',
filebrowserUploadMethod: 'xhr',
fileTools_requestHeaders: {
'X-Requested-With': 'XMLHttpRequest',
'your_custom_header_name': 'custom_header_value'
}
}
I will attach a reference here
fileTools_requestHeaders
filebrowserUploadMethod
In the code sample above,
filebrowserUploadUrl
: is the api-url that ckeditor will call while uploading
when uploaded ckeditor emits fileUploadRequest
event,
you can change/set headers after catching that event too.
filebrowserUploadMethod
: when set to 'xhr', it allows you to set the extra headers, by default value will be 'xhr' only.