16

Can I use Heroku to deploy an HTML prototype?

My HTML prototypes live on Github and Heroku would be a nice way to deploy them so clients can view them.

It seems that this is unsupported, since Heroku expects a Rails/NodeJS/[insert language here] structure or it won't run.

Push rejected, no Cedar-supported app detected

Are there any tricks to circumvent this?

4 Answers 4

12

The best solution would be to use a buildpack designed for hosting static content.

I'd suggest the experimental heroku/heroku-buildpack-static buildpack. In brief, just set the buildpack:

heroku buildpacks:set https://github.com/heroku/heroku-buildpack-static.git

And add a static.json indicating which directory contains your static assets:

{"root":"public"}
Sign up to request clarification or add additional context in comments.

3 Comments

This worked for me. I just deployed a static site since static pages are not an option on Google Drive or DropBox
heroku-buildpack-static is incompatible with Heroku API v22. The project was deprecated in summer 2022.
Worked 100% file MUST be called index.php. I had home.php which did not cut it ! Thank you.
6

The least effort solution is to rename your default file to index.php and redeploy. Heroku will detect it as a PHP site and use that buildpack.

Alternatively, you can follow this guide https://devcenter.heroku.com/articles/static-sites-ruby to set up a sinatra app to host it.

4 Comments

Thanks for the ideas. I use Jekyll so renaming my main file to .php specifically for deployment would break my dev flow. This wouldn't really make it "automatic" anymore which is more or less the point of using Heroku.
in that case, use a Jekyll buildpack :) github.com/mattmanning/heroku-buildpack-ruby-jekyll
This would be a nice idea if Jekyll was the only part of the build. However, I use a "complicated" build system involving multiple parts (see github.com/happyplan/happyplan - jekyll, compass, image compression etc. ) so basically I want to be able to upload the compiled "result" of my build process and not the actual Jekyll files. I figure there must be a solution for this since for example Angular apps will also be "just HTML".
+1 for the idea of changing index.html to index.php -- that's by far the easiest way to achieve the stated goal of deploying a flat HTML site to Heroku. I just did it and it worked well (although the output indicated that this might be deprecated).
1

I've not done it before but since you mentioned using github. Why not use Github Pages to show the prototype.

2 Comments

I need the URLs to be unguessable and private.
Ah fair enough. My Apologies. Interpreted it as you wanting to display a portfolio.
0

You can always use an nginx buildpack to run nginx on heroku:

https://github.com/neilmiddleton/heroku-buildpack-nginx

I've used it with great success to handle a large batch of complex redirects and act as a reverse proxy to a new heroku app for an old, defunct application. Here's a simple config example that will get a static site up and running: https://gist.github.com/leklund/5877422.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.