Assets not running at an isolated endpoint

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)

    # 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

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.

+4
source share
1 answer

, . action_pack , :

/gems/actionpack-3.2.22.2/lib/sprockets/bootstrap.rb 

app.routes.prepend do
  mount app.assets => config.assets.prefix
end

/gems/sprockets-2.2.3/lib/sprockets/server.rb

, , .

, , Admin::Engine , , .

asset_host . .

0

All Articles