尝试访问作为端点安装在中间件中的隔离引擎内的资产时,我遇到了 Not Found 错误。我正在尝试从引擎中访问资产,因此应该能够找到它们。
我怀疑资产路由不起作用,因为我将某个域上的请求路由到端点的方式:
require 'addressable/uri'
class AdminRouter
def initialize(app)
@app = app
end
def call(env)
request = ActionDispatch::Request.new(env)
# Allow requests to the admin system through without going any further
if request.host == Rails.application.config.admin_address
Admin::Engine.call(env)
else
@app.call(env)
end
end
end
我这样做是因为我不希望从主应用程序访问管理应用程序路由,反之亦然。它运作良好,只是不是资产。