Skip to content

Instantly share code, notes, and snippets.

@gerardo-junior
Last active August 29, 2023 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerardo-junior/71aebc33949e34fac6316726db5fb8f7 to your computer and use it in GitHub Desktop.
Save gerardo-junior/71aebc33949e34fac6316726db5fb8f7 to your computer and use it in GitHub Desktop.
Reverse proxy config for diyhue works with alexa running on the same host with multiple services on port 80/443 after pairing
set $upstream_app diyhue;
set $upstream_port 80;
set $upstream_proto http;
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
# allow controlling lights
location ~ ^/api/(.*)/lights/(.*)/state[/]*$
{
proxy_pass $upstream_proto://$upstream_app:$upstream_port/api/$1/lights/$2/state;
limit_except GET PUT {
deny all;
}
}
# allow controlling groups
location ~ ^/api/(.*)/groups/(.*)/action[/]*$
{
proxy_pass $upstream_proto://$upstream_app:$upstream_port/api/$1/groups/$2/action;
limit_except GET PUT {
deny all;
}
}
# deny get configs keys
location ~ ^/api/(.*)/config
{
deny all;
}
# everything else is read-only
location ~ ^/api/(.*)$
{
proxy_pass $upstream_proto://$upstream_app:$upstream_port/api/$1;
limit_except GET {
deny all;
}
}
# https://community.openhab.org/t/howto-hide-hue-bridge-behind-reverse-proxy/79744
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment