I had the same issue (HTTP 403). I am using WP 5.8, Nginx, PHP 7.4 and the Gutenberg PDF Viewer Block plugin. This plugins works by “injecting” (so to say) the PDF file into de viewer:
http://myIntranetServer/wp-content/plugins/pdf-viewer-block/inc/pdfjs/web/viewer.html?file=http://myIntranetServer/wp-content/uploads/2021/08/myfile.pdf
I have a security directive (in an include file) that prevents file injections, like this:
set $block_file_injections 0;
if ($query_string ~ “[a-zA-Z0-9_]=http://”) {
set $block_file_injections 1;
}
…
if ($block_file_injections = 1) {
return 403;
}
…
I would suggest to review your web server config.
Yes but,
It is no more in line with security rules to call directly a PHP module.
I think the development of PDF.JS has to be updated to a safer technology.
Another problem, this time from the Netherlands. I use for some years this plugin, no problems. After looking for a solution I found this example of the url, but using this : no solution.
Still only this error message : Forbidden.
You don’t have permission to access this resource. while I ‘m using the plugin for some years.
Sure, I understand the plugin can’t find the file, but the file is still at the same place, just like these other 60 pdf files on that particular website. And now a big white empty page.
That can’t be a simple not found error.
About a month earlier all pdf’s were normal visible.
I’m working on creating an updated way of loading PDFs to avoid directly loading PDFs.
Any updates on the solution? I’m getting the same error.
There is now an Alternative PDF Loading option on the settings page that tries to load the PDFs via a custom URL rather than directly via a PHP file. You can give that a try. Let me know how it works.
Of note, all the options are not yet built in, it just loads the PDF.
Hello there !
” I have encountered this error twice: “pdf.js v2.6.347 (Build: 3be9c65f)
Message: Unexpected Server Response (403) While Retrieving PDF “. not Server error or PHP version as somebody said..
** After finding out and the main solution is the .htaccess file according to the link: //your_site.com/wp-content/uploads/dae-uploads/
** I delete the contents inside and .pdf WORKS AGAIN. – There are now a limited is “# Any Changes to the Directives Between the Markers Will Be Overwritten.” Need to overcome thoroughly – instead of just editing / delete .htaccess as above … temporary solution.`
Hope that help !