简体   繁体   中英

Ruby on Rails: PDF.JS ActionController::RoutingError (No route matches [GET] “/pdf js/web/viewer.html”):

I'm using PDF.js in a rails application from https://github.com/shyammohankanojia/pdfjs_rails . I followed the instructions and everything works fine in development, but in production the viewer doesn't show the pdf.

I got the following error: "ActionController::RoutingError (No route matches [GET] "/pdf js/web/viewer.html"):".

I'm sure that pdf's are uploaded correctly in production. I ran bundle install and precompiled assets again. In development I didn't have to make any changes to routes.rb.

Any thoughts on how can i get the viewer to show the pdf in production?

thanks for your help, i found that changing this line in production.rb "config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?" for this one "config.serve_static_files = true" will do the trick

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM