-
Notifications
You must be signed in to change notification settings - Fork 175
Description
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 find pdf.worker.js
.
# routes.rb
mount PdfjsViewer::Rails::Engine => "pdfjs", as: 'pdfjs'