HA Redirect
One of the first thing you ought to do with Home Assistant is to setup SSL/HTTPS. It is mandatory if you plan to expose it to the world and good idea even on your local network. But one thing was bugging me when I got my HTTPS setup. Home Assistant wouldn’t redirect good old port 80 requests to the new HTTPS port. Nope, it would just listen on port 443.
And yes, strictly speaking, that is acceptable behavior. But, after being redirected to error page one more time, I decided to do something about it.
After messing a lot with Nginx add-in, I figured that either I am doing something wrong or Nginx add-on simply cannot be configured to do what I want. And, realistically, I needed something much simpler than that. As it often happens, I decided to see how hard is it to make Home Assistant add-on. Good new - it is not that hard.
Fruit of that research is HA Redirect add-on. It is a simple Alpine-based nginx installation that will listen on port 80 (configurable). And the only thing that it does is a humble redirect.
At the same time, I think it is a great example of minimal Home Assistant add-on. It is as close as one can get to the bare minimum while still providing a service.
Now, this app might not be needed for everybody. Maybe you were more successful in setting up Nginx add-on or this “issue” doesn’t bother you because you use HSTS so https redirect will be remembered. Or you were better than me at finding already existing solution. But, if you do have the same issue I had, this add-on might be for you.
Project is available on GitHub.
