Assets not working in isolated engine endpoint

Viewed 86

I'm getting Not Found errors when trying to access assets inside an isolated engine mounted as an endpoint in a middleware. I'm trying to access the assets from within the engine, so they should be able to be found.

My suspicion is that asset routing isn't working because of the way I'm routing requests on a certain 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'm doing it this way because I don't want the admin application routes accessible from the main app and vice versa. It's working well, just not the assets.

1 Answers
Related