thoughtbot/ember-cli-rails

Torii oAuth Static Redirect Page not served as asset with Ember-CLI-Rails

Opened this issue · 3 comments

hhff commented

Hi there! Thanks so much for this lib - it's made my life super easy! I love it - congrats!

I'm using Torii for integrating Stripe Connect.

The Torii lib has deprecated the redirect_uri for oAuth being a URL that loads your ember app (for security reasons), and now expect that you'll point to their static HTML page instead (in the host app it's available as a static asset at localhost:4200/torii/redirect.html).

When serving the app from Ember CLI Rails, however, the /torii/redirect.html route is not considered an asset, but treated as an Ember route, and thus loads the application (creating the aforementioned security risk).

I'm guessing there's somewhere in Ember-CLI-Rails (or in the rails stack) that is treating .html as an app route rather than an asset.

Of course I could move the redirect page into rails, but ideally, I'd rather serve the page directly from Torii for that it's not something I need to update when upgrading Torii in the future.

Any suggestions for handling this?


Which operating system and version is the project developed on?
Mac OS Sierra

Which version of ruby is the project developed on?
2.3.1

Which version of npm is the project developed on?
Yarn

Which version of ember-cli is the project developed on?
2.14

What is the rails version?
5.1

What is the ember-cli-rails version (from Gemfile)?
0.9

What is the ember-cli-rails-addon version (from package.json)?
0.8

Is your application server multi-threaded
(such as puma and unicorn) or is it multi-process (such as thin and webrick)?

puma

What are the contents of config/initializers/ember.rb?

EmberCli.configure do |c|
  c.app :dash, build_timeout: 60
end

What are the contents of the Rails' view that renders the Ember application?
NA

How are the EmberCLI-related routes defined?

class DashSubdomain
  def self.matches? request
    request.subdomain == 'dash'
  end
end

Rails.application.routes.draw do

  constraints(DashSubdomain) do
    mount_ember_app :dash, to: "/"
  end

  # etc
end

I'm also interested in this

cwick commented

I also need the ability to serve HTML files as a static asset

cwick commented

I'm working around it for now by manually defining a route to the static HTML file in routes.rb, and using

send_file Rails.root.join('path/to/html_file''), type: 'text/html; charset=utf-8', disposition: 'inline'