Hacker News new | ask | show | jobs
by mehulkar 4504 days ago
Is there a way to redirect all[1] requests to index.html? The use case is an Ember app that uses history location and is deployed as a static website. In this case, requests to `/whatever` still need to serve index.html and let Ember handle the routing. Can GAE app.yaml specify rules like this?

I ran into this problem with S3 and ended up writing a simple server to handle it and deploying to Heroku.

[1] By all, I mean all except the ones to /assets or something similar.

2 comments

Did you try using Cloudfront with S3? I believe it solves the problem you detailed with regards to redirects.
Nope, didn't try Cloudfront. I'll look into it, thanks!
If you still run into problems, reply back to this and I can get in touch to help (no cost).
Something like this?

handlers:

- url: /.*

  mime_type: text/html

  static_files: static/index.html

  upload: static/index.html
Anything you don't want to go to index.html you can just put before that handler since it processes the app.yaml from top to bottom and stops at the first match.