0 votes
1 view
in AWS by (16.7k points)

I'm trying to use pdf.js with range requests (progressive loading of the pdf document), but when I'm trying to load the pdf from amazon s3 urls this error appears in the console :

-Refused to get unsafe header "Accept-Ranges"

and the pdf doesn't load via 206 partial content (range requests) but 200 and then viewed in the viewer.

1 Answer

0 votes
by (39.6k points)

Set your Amazon CORS policy like this:

<?xml version="1.0" encoding="UTF-8"?>

<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">








        <!-- this part is critical -->




        <ExposeHeader>Content-Length </ExposeHeader>




This might help.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !