I get Not Found errors when trying to access resources inside an isolated engine installed as an endpoint in middleware. I am trying to access assets from within the engine, so they must be found.
My suspicion is that resource routing does not work due to the way I forward requests to a specific domain to the endpoint:
require 'addressable/uri'
class AdminRouter
def initialize(app)
@app = app
end
def call(env)
request = ActionDispatch::Request.new(env)
if request.host == Rails.application.config.admin_address
Admin::Engine.call(env)
else
@app.call(env)
end
end
end
I do it this way because I do not want administrator application routes to be accessible from the main application and vice versa. It works well, not assets.
source
share