我在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请求资产,或者我需要让子域也提供资产。我该如何解决这个问题?