Heroku返回404资产

时间:2019-10-11 13:19:22

标签: ruby-on-rails heroku

我有一个在heroku上部署的Rails 6应用程序。资产已编译并存在于heroku中,但heroku不为它们提供服务。

在尝试加载页面时,我获得了针对资产(css,js,图像)的404。

我已确认资产位于服务器上的pubic / assets文件夹中。似乎也了解它们,因为我可以做到:

setInterval(function() { 
  if (window.innerWidth < 1200) {
    // do the thing you want if its smaller than 1200
  } else {
    // do the other thing
  }
}, 3000);

我正在运行webpacker和yarn以及资产管道。我正在使用彪马。

这些是来自application.html.erb

的相关内容
heroku run rails console
irb(main):002:0> puts helper.asset_path("help.png")
/assets/help.png

我希望可以提供这些资产,但是控制台日志会为每个资产显示404,例如'https://xxxx/assets/application.js','https://xxxx/assets/application.css'

谢谢 尼克

0 个答案:

没有答案