How can I serve as embedded static content on Heroku?

I have a rails application with static content in the public directory (e.g. public/index.html ) and additional static content in nested subdirectories (e.g. public/one/two/index.html ).

All static content is served correctly if I run it locally via script/server , but when I load it into Heroku at the top -level loads correctly, but the embedded content returns 404.

I found several resources (like this question ) that discuss static content on rails, but they all seem to take a pretty simple structure with one directory containing all the files.

Can this be fixed?

+4
source share
2 answers

If you have a very simple web application (mostly static content, say), then using Sinatra on Heroku is much easier to configure and prevent this type of problem.

+1
source

You can serve static content on Heroku without writing any β€œcodes” at all ... you just need to specify the β€œRack” middleware where the content is located (as described in this help article):

http://devcenter.heroku.com/articles/static-sites-on-heroku

+1
source

Source: https://habr.com/ru/post/1307596/


All Articles