Simple HTTP server/file hosting for Home Assistant (useful for OTA)

Home Assistant offers a built-in, very simple way to host files on its own HTTP server. This can be very useful when we want to perform OTA (remote firmware update) on some device that expects to give it a URL with a file and only supports HTTP. An example of such a situation may be Tasmota (when we want to upload our own build) or Sonoff NSPanel (the FlashNextion command to change the display firmware also requires the file URL).
The situation is complicated by the fact that often newer hosting solutions available on the web force HTTPS, which makes it impossible, for example, to download this Nextion via ordinary HTTP. For the same reason, for example, it is not possible to download binaries directly from Github.
You can easily set up an HTTP server at your place, for example using Visual Code, or Node.JS, or other Python tools, but why? Just use HA...
Here I will briefly show how this can be done.
HTTP hosting in HA
I wrote quite a lot about HA itself in this topic:
Tutorial Home Assistant - configuration, WiFi, MQTT, Zigbee, Tasmota
Some convenient access to it will be useful, I mapped the config folder via SMB:


This allows you to conveniently operate on the Assistant's files:

We upload the files we want to host to config/www :

For me, there are ripples for the Sonoff panel, which I will describe soon.
You can get to them from a web address like:
http://192.168.0.113:8123/local/ns-panel.tft
The subdirectory is very important local We can't get to them without him!
Just opening this URL will download the file - without logging in:

And it is this URL that can be given to devices that need to download our update via HTTP GET...
Summary
I have the impression that few people know about this option, and it is most useful. It is worth knowing about it, the more that no one will guess that these files are available in the subdirectory local and as we know, users often skip reading the documentation...
It turns out that hosting files on HA itself is very simple - just right for OTA.
PS: Of course, remember that if our HA is only in the local network, these files will only be visible in the local network. But we rather know that, don't we? Same as other servers.
Comments
Hello, @pkaczmarek2 I'm trying to do this without success... I have Home Assistant installed via Docker in a local server with Ubuntu Server as OS. Could this be the cause? Thanks! [Read more]
I've been testing the HASS HTTP server on my dedicated HASS VM, made with official (?) image downloaded from web. I am not sure about Docker, but maybe first you should try whether the HTTP port is open... [Read more]
This seems way too complicated for such small task. Python has build in server, just run python -m http.server [Read more]
It depends, some people may have blocked incoming connections to their machine for security purposes. Still, the Python http server is very useful, I am also sometimes using it as a base for my custom... [Read more]
Progress so far, after reading this : - Added "http:" to configuration.yaml file in HA /config directory - Created "www" under /config - Files stored in "www" are accessible via http://192.168.1.249:8123/local/filename.ext... [Read more]
I do not remember well but I check this and it seems that you need to first install SMB Samba Share addon for HA. I think I did that, but it was a year ago or so... https://obrazki.elektroda.pl/2047092300_1713355856_thumb.jpg... [Read more]
I'm afraid I can't access the add-on store because of my docker-compose install of HA... I remember I read some (most) of the add-ons also have a docker version, but I still haven't found this one. What... [Read more]
Good job! So, everything is working now? [Read more]
Yes, but still trying to figure out how to host Webapp in there... Copied the contents of https://github.com/OpenBekenIOT/webapp/tree/gh-pages to config/www and then changed the URL of the app in the... [Read more]
I tried again after re-reading this thread and related ones but with no luck... This is the error I get: https://obrazki.elektroda.pl/7647758800_1722083473_thumb.jpg Maybe I have to configure... [Read more]
So currently you're not able to host any files on HA? Any web page, not just OBK Web App [Read more]
I've tried with a simple txt and can read it from the browser. Also, if I put 192.168.1.249:8123/local/startup.js in the browser it lists the script there so yes, files are hosted there, but the webapp... [Read more]
This is not the correct way to run web app. Do you change Web App URL In the OBK device setting to point to your self-hosted app? [Read more]
That was just a test to check that the files are accessible but, as I said here , I also changed the app's URL to http://192.168.1.249:8123/local/ in OBK's configuration. EDIT: Another test, devicesList.html... [Read more]
Problem solved! With a "little help" from ChatGPT . I just had to add the following to configuration.yaml in Home Assistant: http: cors_allowed_origins: - http://localhost:8123 ... [Read more]
It’s great to see Home Assistant being used for file hosting! This built-in HTTP server feature is a lifesaver when devices need to access files via HTTP, like with Tasmota or Sonoff NSPanel. It’s a real... [Read more]
If you're looking for a straightforward HTTP server or file hosting, they offer reliable offshore server options that could be perfect for your needs. [Read more]