{"id":1976,"date":"2022-08-30T15:21:01","date_gmt":"2022-08-30T15:21:01","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/08\/invalid_access_err-when-trying-to-render-a-pdf-using-pdf-js-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:21:01","modified_gmt":"2022-08-30T15:21:01","slug":"invalid_access_err-when-trying-to-render-a-pdf-using-pdf-js-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/invalid_access_err-when-trying-to-render-a-pdf-using-pdf-js-collection-of-common-programming-errors\/","title":{"rendered":"INVALID_ACCESS_ERR when trying to render a pdf using PDF.js-Collection of common programming errors"},"content":{"rendered":"<p>I have an s3 bucket hidden behind an nginx proxy. If I try to view a PDF using that proxy, I get this error<\/p>\n<pre><code>XMLHttpRequest.responseType cannot be changed for synchronous HTTP(S) requests made from the window context.\nWarning: Unhandled rejection: Error: INVALID_ACCESS_ERR: DOM Exception 15\n<\/code><\/pre>\n<p>But that same link downloads the file if I visit it from my browser.<\/p>\n<p>This is my nginx configuration for the proxy_pass<\/p>\n<pre><code>location ~* ^\/s3_redirect\/(.*) {\n    internal;\n\n    set $full_url               http:\/\/$1?$query_string;\n    set $s3_bucket              'my_bucket.s3.amazonaws.com';\n\n    proxy_http_version          1.1;\n    proxy_set_header            Host $s3_bucket;\n    proxy_set_header            Authorization '';\n    proxy_hide_header           x-amz-id-2;\n    proxy_hide_header           x-amz-request-id;\n    proxy_hide_header           ETag;\n    proxy_hide_header           Last-Modified;\n    proxy_ignore_headers        \"Set-Cookie\";\n    proxy_buffering             off;\n    proxy_intercept_errors      on;\n\n    proxy_pass                  $full_url;\n}\n<\/code><\/pre>\n<p>Using the s3 url instead of the proxy url, PDF.js works and correctly renders the file.<\/p>\n<p>Can someone help me fix this?<\/p>\n<p id=\"rop\"><small>Originally posted 2013-12-08 05:26:55. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1976","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1976","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1976"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1976\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}