This Magic Mirror² module allows you to proxy a request from the browser to the backend, useful for development or accessing a local resource that does not include the Access-Control-Allow-Private-Network
header. [CORS-RFC1918 - Private Network Access]
This module does not expose any configuration entries. To use it you just prefix your urls with localproxy/?url=
.
For example this image from Home Assistant:
http://<ip>:8123/local/imgs/x >> localproxy/?url=http://<ip>:8123/local/imgs/x
Or this example that uses a icon from a server with the MMM-VisualNotifications module:
"display": [{
"type": "icon",
"url": "localproxy/?url=http://<ip>/icons/x"
}],
You can directly use the proxy
[MM2 Origin]/localproxy/?url=[Request]
. Remember to configure theipWhitelist
entry to only the devices that you want to be able to access the mirror.
- Clone this repository in your
modules
folder:
cd ~/MagicMirror/modules # Change acordingly to your folder structure
git clone https://github.com/Fabrizz/MMM-LocalProxy.git
- Install dependencies:
cd MMM-LocalProxy
npm install
- Add the module to your
config/config.js
file
{
module: "MMM-LocalProxy",
},
With <3 by Fabrizz
fabriz.co