sap.m.UploadCollection add "random" request headers
OpenUI5 version: 1.44.9
Browser/version (+device/version): Chrome 48.0.2564.116 (64-bit)
Any other tested browsers/devices(OK/FAIL): Safari OK
URL (minimal example if possible):
User/password (if required and possible - do not post any confidential information here):
I have written a web app for my company that incorporates sap.m.UploadCollection. The target of the upload is a system at a different URL. When I try to start the upload it fails on Chrome with this reason... "Request header field requestId1496864333304 is not allowed by Access-Control-Allow-Headers in preflight response"
UploadCollection is adding the "requestId1496864333304" and "fileNameRequestId1496864333304" as request headers
But since the numbers at the end are "random" my server cannot respond with an appropriate "Access-Control-Request-Headers" reposes to the pre-flight request from Chrome.
There for the upload fails.
What is the expected result? The file uploads
What happens instead? Error message from Chrome
These headers either should not be sent or I should be able to control if they are sent. If the headers are added by the browser itself then I'll have to find a workaround.
Hello @DeanDavis , Thank you for sharing this finding. I've created a internal incident 1780186244. You can check its status on GitHub. Regards, Diana
Hello @DeanDavis, I'm Oli from the responsible develeopment team. The intension of these parameters is only internally by the control itself. We need the parameters to handle progress indication, aborting / cancleing of request and error handling. To solve your backend issue, you can add the following header parameter via the uploadcollection control. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers The control creates there request headers as constants. You can access this via UploaCollectionInstance._headerParamConst property. I will provide a fix for this as well, as a quick fix you can try out the above idea. Feedback is welcome :-)
Best regards, Oli..
Thanks Oli, I understand the need so I have implemented CORS on my backend to reflect the headers you are sending as allowable.
I can now upload files.
But I have another issue and this may not the the correct forum to ask this question, if not please directly to a place where I can ask about this issue.
I cannot get FileUploader to display the progress of the upload. The items aggregation is bound to my model and I'm using "instant upload" to add a file. In the example for FileUploader, right when the upload starts a line is added to the list and you can see the progress of the upload. This doesn't happen for me.
I can see the file upload using my developer tools but an entry is only added to the list when I receive the "uploadComplete" event and I update the model with the new entry.
My backend is IIS8.5 and the file upload is being handled by a Node.js application.
Any suggestions?
Hey @DeanDavis, nice to hear that you can now upload your files :-) The UploadCollection exposes the change event in case a file is selected for upload. Within the event handler you should register to, you need to invalidate the UploadCollection by calling: UCinstance.invalidate(); This is not intendet to be needed but because of backwards compatibility we cannot change this behavior. If you invalidate the UploadCollection control you should be able to see the progress indicater. If not, feel free to come back :-) Best regards,
Oli..
Brilliant, that worked. Thanks. I would have never figured that on my own and spent a day and a half trying to figure out how to get it to work. Is there a proper user forum with experts like yourself where a question like mine, when I run into a roadblock, is better asked? I'd don't like filing a report in GitHub unless I think it is a bug or something that doesn't make sense. And when I see expected behavior working in the example program but not working in my program I tend to believe it is my issue and wouldn't usually file a bug report just to get tech support.
Thanks again very relived to get this working.
@DeanDavis, nice to hear again that it is working now :-) I forwared you last question about a kind of forum because I'm not aware of something, but maybe there is a place. I will post a comment again when I get an answer. Mayn greetz, Oli..
Thanks. One last comment then. I see a lot of English text built into this control. How can I localize it to different languages?
See the tutorial for translation :-) https://openui5.hana.ondemand.com/#docs/guide/df86bfbeab0645e5b764ffa488ed57dc.html
Hoi again :-) There are 2 places where you can discuss and ask in communities.
- slack.com/openui5
- https://stackoverflow.com/questions/tagged/openui5
Doei, Oli..
Hi, I have the exact same issue as @DeanDavis. I am trying to upload a file through the sap.m.UploadCollection to an external system running on another system. I've sniffed the traffic with Fiddler and I see that the "Access-Control-Request-Header" is set with the following values:
- authorization
- content-type
- filerequestid1500xxxx
- requestid1500xxxx
Honestly, I didn't understand the solution mentioned in one of the prior posts. As far as I understood the solution, @DeanDavis passed these headers from the backend to the client? As I have no influence on the external I cannot adapt the behaviour of the CORS implementation on the backend. Is there any solution, how I can upload through the sap.m.UploadCollection to that external system?