I have a problem with Chrome not sending headers containing "special characters", such as the Swedish ÅÄÖ. If I strip these special characters it all works fine. Here’s a simple example:
$.ajax({
type: 'POST',
url: '/echo/html/',
headers: {
"SomeHeader":"ÅÄÖ" // This header will be removed.
"SomeOtherHeader":"ABC" // This header will be sent.
},
data: {
foo: 'bar',
delay: 1
}
})
.fail(function(data){
alert("Error!");
})
.done(function(data) {
alert("Success!");
});
When looking at the network-tab in Chrome it’s obvious that one header is missing. I tried setting the Content-Type
to: application/json; charset=UTF-8
without any luck.
The error occurs in Chrome (85.0.4183.121 x64). Edge sends the header, but with empty content (!?). IE11 and Firefox sends the header with all it’s content.
Here is a reproducable fiddle:
http://jsfiddle.net/qr8j0cgo/
How can I tell Chrome (and all the other browsers) to send the header containing my special characters?
As an extra requirement my real world problem involves a content-type with multipart/form-data
and boundary.
I know that I can encode the characters with practically any encoding (even base64) and thus make a workaround. But I cannot change anything on the server, so the request needs to be the same (or at least interpreted the same as before).
2
Answers
The issue was with the Chrome extension ModHeader. When disabling it everything worked as expected.
I am running on Google Chrome 88.0.4324.96 (Officiell version) (64 bitar).
I would bet on corporate network filter.