2

我的子域设置routes.rb如下:

  scope constraints: { subdomain: 'advertiser' } do
    root to: 'static#sub_index'
  end

当我导航到此页面时,我的所有 javascript 和 css 资产(包括内置默认值)都会出现 404 错误。

GET http://advertiser.subdomtest.dev/assets/application.css?body=1  advertiser.subdomtest.dev:5
GET http://advertiser.subdomtest.dev/assets/static.css?body=1  advertiser.subdomtest.dev:6
GET http://advertiser.subdomtest.dev/assets/jquery.js?body=1  advertiser.subdomtest.dev:7
GET http://advertiser.subdomtest.dev/assets/jquery_ujs.js?body=1  advertiser.subdomtest.dev:7
GET http://advertiser.subdomtest.dev/assets/turbolinks.js?body=1  advertiser.subdomtest.dev:7
GET http://advertiser.subdomtest.dev/assets/static.js?body=1  advertiser.subdomtest.dev:7
GET http://advertiser.subdomtest.dev/assets/application.js?body=1  advertiser.subdomtest.dev:7

我已经尝试过制作一个新的应用程序并且可以始终如一地重现它,所以我必须设置错误。

要么我需要从http://subdomtest.dev/assets请求资产,要么我需要让子域也提供资产。我应该如何解决这个问题?

4

0 回答 0