Alcumus / react-doc-viewer

Apache License 2.0
208 stars 101 forks source link

Returns 403 Forbidden error for AWS pre-signed PDF files #85

Open notable-tony opened 3 years ago

fredc97 commented 2 years ago

The problem is that the presigned url works only for a specific operation... You can put the fileType, so the HEAD from react-doc-viewer will not be call.

meticoeus commented 2 years ago

Sound like this should added to the documentation.

lukeschunk commented 2 years ago

@fredc97 this is the work around i landed on. when i made the presigned URL work with a HEAD request, the subsequent GET failed.

i put "application/pdf" for a fileType and it's working for PDFs. Not sure what the workaround will be for trying to display multiple file types yet. Feels bad to have to do client side mapping/parsing but that might be what I land on.

fredc97 commented 2 years ago

@lukeschunk If I recall correctly, AWS return to you the mime type of the file, so you just pass it to the fileType attribute of the document !