0

I've got an app on Heroku that contains uglified JS code. I'd like to include my original sources (.js) in my public folder so that I can refer to them from a source map for debugging. I don't want the source files to be viewable by just anyone, however: I'd like to restrict access to a certain set of IPs.

In other words, in my Rails app on Heroku I'd like to have a file here:

myapp.herokuapp.com/unminified_sources/my_file.js

And I'd like to restrict access to this file to a certain IP (mine).

Is this possible on Heroku? How? Can I use an .htaccess file?

Community
  • 1
  • 1
dB'
  • 7,838
  • 15
  • 58
  • 101

1 Answers1

0

You can put the file behind a unminified_sources_controller my_file action that responds to js requests and restrict it that way. You can restrict in the route or add a before_filter to test for IPs.

You can stream the file. http://guides.rubyonrails.org/action_controller_overview.html#sending-files

Mark Swardstrom
  • 17,217
  • 6
  • 62
  • 70