A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true #399
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Response to preflight request doesn't pass access control check: A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:3001' is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute.
Can anyone help me how to setup the header ?
hello @padiyan I have the same problem, are You solved?
Nope, I started using "ng2-uploader" https://github.com/jkuri/ng2-uploader
I solve this problem extending the class FileUploader, this code is a cody from other post
class MyUploader extends FileUploader {
onAfterAddingFile(file: any) {
file.withCredentials = false;
}
}
and in my html
@wladimiravila 's idea works. Instead of extending the class FileUploader, I register the onAfterAddingFile event as following:
this.uploader.onAfterAddingFile = (file)=> { file.withCredentials = false; };Thank you @xiaolei You saved me!
I tried @xiaolei 's fix, but I still got the error message:
Response for preflight has invalid HTTP status code 404.With my server, I just had to add a dummy OPTIONS for that endpoint, just to pass the pre-flight:
options("/test", (req, res) -> "OKAY");@xiaolei thank you!!!!!!!
@xiaolei Your answer saved my day!
If it works with POSTMAN, it should work on here, very disappointing code ~ SC
I placed this in my component :
and it works in display but doesn't upload anything, I get this output for each file :
Seem to be passing an Empty array to the API Server.
Any ideas would be appreciated : )
thank xiaolei . it worked for me. I hope this problem will be fixed by creator so other people not to have the same problem. this was an annoying problem for me. really thank xiaolei
Thanks @xiaolei , You saved the day thanks a lot!!!
@xiaolei, thank you!
Thank you @xiaolei
Thank You @xiaolei