Fabrizz / MMM-LocalProxy

A MagicMirror2 module that proxies requests from the browser to the backend. Useful for development or CORS in a private network

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fabrizz logo

MMM-LocalProxy

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]

Usage

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 the ipWhitelist entry to only the devices that you want to be able to access the mirror.

Instalation

  • 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 Fabrizz logo

About

A MagicMirror2 module that proxies requests from the browser to the backend. Useful for development or CORS in a private network


Languages

Language:JavaScript 100.0%