0

I have the following post request by which I am trying to upload a PDF FIle on Alfresco Community Version On-Premise Server:

      var urlPost = 'http://127.0.0.1:8080/alfresco/service/api/upload?alf_ticket=' + ticket;
      let header = new HttpHeaders();
      header = header.append("Authorization", "Basic " + btoa("user:passwoed"));
      var formData = {
        filedata: file,
        filename: fileName,
        siteid: 'uploadsite',
        containerid: 'documentLibrary',
        uploadDirectory: '/',
        description: 'Test description',
        contenttype: 'cm:content',
        thumbnails: 'doclib',
        overwrite: 'false',
      };
      this.http.post(urlPost, formData, { headers: header }).subscribe(response => {
        console.log(response);
      }, err => {
        console.log("User authentication failed!");
      });

But I am getting the following error:

 Error 403: Response for preflight does not have HTTP ok status.

It works when I hit request with postman.After some research, I have found that I need to change my back-end to not to require authentication for the OPTIONS method, but I am not sure how to do that too.

I am new here and any help will be appreciated. Thanks!!

Himanshu Jindal
  • 113
  • 1
  • 8

1 Answers1

0

I had similar problem with my Angular 5 application. Please take a look here for back-end settings. There you will find how I resolved issue with preflight requests.

If you need more help please let me know.

Joe Belladonna
  • 1,349
  • 14
  • 20