IE11 multipart form data request fails but works when console is opened

786 views Asked by At

My frontend is written in Polymer and my backend is a Spring Boot application with Jersey.

I have a weird issue in IE11 when I upload a file. I need to send the file and some JSON data at the same time as part of the multipart/form-data request. I'm using vaadin-upload component to upload the file. Looking at the code nothing weird seems to be done when uploading i.e. they use XHR and FormData interface but nothing too advanced that would not be compatible with IE 11 (from what I've seen).

When trying to upload a file with the console (F12) closed the HTTP dump is as follow (some headers are removed and the pdf content is truncated):

POST http://localhost:10004/api/documents HTTP/1.1
Content-Type: multipart/form-data; boundary=---------------------------7e22971016a09e2
Content-Length: 283537
Host: localhost:10004

-----------------------------7e22971016a09e2
Content-Disposition: form-data; name="document"; filename="test.pdf"
Content-Type: application/pdf

%PDF-1.5
...
%%EOF
-----------------------------7e22971016a09e2--

****

HTTP/1.1 500
Content-Type: application/json
Date: Mon, 05 Feb 2018 12:50:16 GMT

{"code":"INTERNAL_SERVER_ERROR","message":"Internal Server Error","httpStatus":{"code":500,"reason":"Internal Server Error"}}

And with the console opened it is as follow:

POST http://localhost:10004/api/documents HTTP/1.1
Content-Type: multipart/form-data; boundary=---------------------------7e228d16a09e2
Content-Length: 283817
Host: localhost:10004

-----------------------------7e228d16a09e2
Content-Disposition: form-data; name="document"; filename="test.pdf"
Content-Type: application/pdf

%PDF-1.5
...
%%EOF
-----------------------------7e228d16a09e2
Content-Disposition: form-data; name="data"

{"id": "123456"}
-----------------------------7e228d16a09e2--

****

HTTP/1.1 200
Content-Type: application/json
Date: Mon, 05 Feb 2018 12:53:14 GMT

{"id":"987654"}

What I can see is that when the console is closed IE does not send the "data" part in the multipart/form-data. I don't know why this happens. It works great in Chrome and in IE when the console is opened (but of course I won't ask the users to open the console).

Any idea on what could cause that behavior?

0

There are 0 answers