no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


Next revision
fuss:node-red [2020/05/24 11:16] – created office
Line 1: Line 1:
 +====== Reverse-Proxying Node-RED and Alexa Philips Hue Emulation Bridge ======
 +
 +The Alexa Philips Hue Emulation Bridge for node-red provided by the ''node-red-contrib-amazon-echo'' package needs to listen on port ''80'' for HTTP requests sent by Amazon Alexa devices performing discovery. Instructions for the ''node-red-contrib-amazon-echo'' package include setting up a port redirect from port ''8080'' used by the Amazon Echo Hub node in the node-red interface to port ''80''. Unfortunately, since port ''80'' is occupied, a webserver performing reverse proxying cannot be placed in front of node-red without some tricks. 
 +
 +One solution is to use nginx and regular expressions in an attempt to match the user-agent of Amazon Echo devices in order to redirect regular HTTP requests to node-red and HTTP requests from Amazon Alexa devices to the ''node-red-contrib-amazon-echo'' listening port on ''8080'':
 +
 +<code>
 +map "$http_user_agent" $targetupstream {
 +  default        http://127.0.0.1:1880;
 +  "~AEO[A-Z]{2,3} Build\/[A-Z0-9]+" http://127.0.0.1:8080;
 +}
 +
 +server {
 +        listen 80;
 +        server_name mynoderedserver.tld;
 +
 +        access_log /var/log/nginx/access.log;
 +
 +        location / {
 +                proxy_pass $targetupstream;
 +                proxy_http_version 1.1;
 +                proxy_set_header Upgrade $http_upgrade;
 +                proxy_set_header Connection "upgrade";
 +        }
 +}
 +
 +</code>
 +
 +The map at the top is responsible for conditionally proxying requests based on the user agents: by default, all requests to the server ''mynoderedserver.tld'' are passed to node-red on port ''1880'' and requests that match the regular expression ''~AEO[A-Z]{2,3} Build\/[A-Z0-9]+'' are delivered to port ''8080'' on which the Amazon Alexa Philips Hue Emulation bridge (provided by ''node-red-contrib-amazon-echo') is listening.
 +
 +The result is that a request via a browser to ''<nowiki>http://mynoderedserver.tld</nowiki>'' will open up the node-red flow design interface. Similarly, requests to: ''<nowiki>http://mynoderedserver.tld/ui</nowiki>'' will open the dashboard provided by ''node-red-dashboard'' package. This removes the need to memorize ports and/or IP addresses.
  

fuss/node-red.txt · Last modified: 2023/11/30 08:39 by office

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.