Empty value for : 'Access-Control-Request-Headers' in request headers #554

Open
opened 2017-01-04 13:05:39 +00:00 by GawandeKunal · 6 comments
GawandeKunal commented 2017-01-04 13:05:39 +00:00 (Migrated from github.com)

Hi ,

I am using this package for asynchronous file upload . I have seen the "empty value" is set for
"Access-Control-Request-Headers" in request headers . Is there any particular reason for this ?
I have searched it in package files as well, but unable to find. Can someone let me know?

Due to this empty value , I am not able to connect this package to my customized webservices for file upload . Getting error for the preflight requests.
ERROR: "
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource"

empty_access-control-req-header

Hi , I am using this package for asynchronous file upload . I have seen the "empty value" is set for "Access-Control-Request-Headers" in request headers . Is there any particular reason for this ? I have searched it in package files as well, but unable to find. Can someone let me know? Due to this empty value , I am not able to connect this package to my customized webservices for file upload . Getting error for the preflight requests. ERROR: " Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource" ![empty_access-control-req-header](https://cloud.githubusercontent.com/assets/17589899/21643053/2ef85eae-d2ac-11e6-9a53-25566348bd2d.png)
Manikandan-CloudevTech commented 2017-01-06 06:16:07 +00:00 (Migrated from github.com)

I too have the same problem.

I too have the same problem.
GawandeKunal commented 2017-01-13 05:25:57 +00:00 (Migrated from github.com)

@Manikandan-Constient Have you find out anything in code ? Actually i want to see if at code level , this value is getting set.

@Manikandan-Constient Have you find out anything in code ? Actually i want to see if at code level , this value is getting set.
GawandeKunal commented 2017-01-18 14:34:32 +00:00 (Migrated from github.com)

Hello All,

It might be the issue with the google chrome itself . You can visit the chromium site and go through the issue given below :
https://bugs.chromium.org/p/chromium/issues/detail?id=633729

Hello All, It might be the issue with the google chrome itself . You can visit the chromium site and go through the issue given below : https://bugs.chromium.org/p/chromium/issues/detail?id=633729
GawandeKunal commented 2017-01-19 05:10:03 +00:00 (Migrated from github.com)

Can anyone confirm from valor software team, if this blank value is being handled on server side ?

Can anyone confirm from valor software team, if this blank value is being handled on server side ?
GawandeKunal commented 2017-01-25 05:48:40 +00:00 (Migrated from github.com)

Workaround for the above issue :

You can add dummy headers in below file to avoid sending blank values in "Access-Control-Request-Headers".

file name : \ng2-file-upload-development\components\file-upload\file-uploader.class

Changes :

public options:FileUploaderOptions = {
autoUpload: false,
isHTML5: true,
filters: [],
removeAfterUpload: false,
disableMultipart: false,
headers: [{name: "dummy", value: "dummy"}]
};

It solved the problem for me . Please let me know if it's helpful for anyone.

Workaround for the above issue : You can add dummy headers in below file to avoid sending blank values in "Access-Control-Request-Headers". file name : \ng2-file-upload-development\components\file-upload\file-uploader.class Changes : public options:FileUploaderOptions = { autoUpload: false, isHTML5: true, filters: [], removeAfterUpload: false, disableMultipart: false, **headers: [{name: "dummy", value: "dummy"}]** }; It solved the problem for me . Please let me know if it's helpful for anyone.
JasonBro commented 2018-11-05 15:48:04 +00:00 (Migrated from github.com)

I came across this problem as well. When posting to another site, the CORS headers are checked by the browser before deciding to allow the request. By default, it would appear that the ng2-file-upload control sends the access control header and, if your CORS headers disallow this, then you get this error.

If you don't want to send access control headers then just disable them by using

this.uploader.onAfterAddingFile = (file) => { file.withCredentials = false; };

as suggested in this answer.

I came across this problem as well. When posting to another site, the CORS headers are checked by the browser before deciding to allow the request. By default, it would appear that the ng2-file-upload control sends the access control header and, if your CORS headers disallow this, then you get this error. If you don't want to send access control headers then just disable them by using `this.uploader.onAfterAddingFile = (file) => { file.withCredentials = false; }; ` as suggested in [this answer](https://github.com/valor-software/ng2-file-upload/issues/1018).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#554