INVALID_ACCESS_ERR when trying to render a pdf using PDF.js-Collection of common programming errors
I have an s3 bucket hidden behind an nginx proxy. If I try to view a PDF using that proxy, I get this error
XMLHttpRequest.responseType cannot be changed for synchronous HTTP(S) requests made from the window context.
Warning: Unhandled rejection: Error: INVALID_ACCESS_ERR: DOM Exception 15
But that same link downloads the file if I visit it from my browser.
This is my nginx configuration for the proxy_pass
location ~* ^/s3_redirect/(.*) {
internal;
set $full_url http://$1?$query_string;
set $s3_bucket 'my_bucket.s3.amazonaws.com';
proxy_http_version 1.1;
proxy_set_header Host $s3_bucket;
proxy_set_header Authorization '';
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;
proxy_hide_header ETag;
proxy_hide_header Last-Modified;
proxy_ignore_headers "Set-Cookie";
proxy_buffering off;
proxy_intercept_errors on;
proxy_pass $full_url;
}
Using the s3 url instead of the proxy url, PDF.js works and correctly renders the file.
Can someone help me fix this?