0

We are loading S3 Pdf file in ngx-extended-pdf-viewer (Angular). But it shows the requested domain does not have an access control header Issue.

Notes:

  1. Files Uploads from PHP laravel backend
  2. We set access control origin header for this domain on https://selvamanidevsaas.selvamani.app But the same issue again

Errors

UnknownErrorException {message: 'Failed to fetch', name: 'UnknownErrorException', details: 'TypeError: Failed to fetch'} details: "TypeError: Failed to fetch" message: "Failed to fetch" name: "UnknownErrorException"

Access to fetch at 'https://s3bucket.s3.ap-south-1.amazonaws.com/work_permit/work_permit_1657881550.pdf' from origin 'https://selvamanidevsaas.selvamani.app' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled

Selvamani P
  • 7,045
  • 3
  • 14
  • 22
  • The link is offline, so I guess you've solved the issue. Can you share your insight with us? – Stephan Rauh Aug 28 '22 at 12:33
  • The PDF viewer does support S3, so I suppose it was really a CORS issue. I suppose you need to add https://s3bucket.s3.ap-south-1.amazonaws.com to your access control header. For debugging, you can simply use "*" to check if there's a fundamental problem. – Stephan Rauh Aug 28 '22 at 12:35

0 Answers0