-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using relative root, pdfjs javascript assets do not load correctly #74
Comments
I was facing the same problem. I found no other solution than editing several files (see my fork https://github.com/nik-ko/pdfjs_viewer-rails.git). Here is what I've done:
In the Instead of these steps you can also use my fork in the To apply the changes in your application run:
In my application this required setting Finally, you have to change the |
i confirmed this is a bug that happened in several gems and rails itselft, happened also in stimulus reflex that due rails is a Domain oriented framework unfortunately, and developers assumed hijacked root Also the documentation from rails are vage and lack of deeps ways to setup a non domain oriented application and as described in https://www.phaedrasolutions.com/blog/how-to-config-subdirectory-with-rails-nginx-unicorn and also well explained at https://jlintusaari.net/deploying-rails-application-to-subdirectory/ By example In
In
This seems do not work and action cable just request always to i found several details for this framework. |
I'm sure there's something I'm overlooking here, but I haven't found a solution yet so I'll stick this here.
I have an application which uses a relative url for the production environment:
Rails.application.config.action_controller.relative_url_root = "/myrelativeroot"
When loading a pdf in development, everything works as intended. However, when I try to do the same in production, I get the following error from the js console:
Loading Worker from “https://mywebsite/pdfjs/web/pdf.worker.js?version=1.10.100” was blocked because of a disallowed MIME type (“text/html”)
It turns out, this file doesn't exists. However, when I go to
https://mywebsite/myrelativeroot/pdfjs/web/pdf.worker.js?version=1.10.100
, the file can be found just fine. Somehow, I need to tell pdfjs to append the relative url in the right spot to findpdf.worker.js
.The text was updated successfully, but these errors were encountered: