Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Home Assistant Web Proxy

License

NotificationsYou must be signed in to change notification settings

dermotduffy/hass-web-proxy-integration

Repository files navigation

A smallHome Assistant integration tooptionally proxy select web traffic through a Home Assistant instance.

Why?

Typical usecases are Lovelace cards (e.g.FrigateCard) that cannot directlyaccess resources required (either because the browser may not be on the samenetwork as the backend resources, or because the browser may not allowMixedContent).

How can this integration help?

There are two main styles of proxying:

  • Statically proxying a set of URL patterns (e.g. Accessinghttps://$HA_INSTANCE/api/hass_web_proxy/v0/?url=http%3A%2F%2Fcam-back-yard.mydomain.io will result in a request tohttp://cam-back-yard.mydomain.io).
  • Accept Home Assistantaction calls to selectively allow proxying, for use in automations orhass-web-proxy-integration aware Lovelace cards that dynamically select what to proxy.

Installation

Add this repository as a custom repository for HACS:

  • NavigateHACS -> Integrations -> [Three dots menu] -> Custom repositories
  • Repository:https://github.com/dermotduffy/hass-web-proxy-integration/
  • Category:Integration
  • ClickADD

Download the integration via HACS as normal:

  • Click+ EXPLORE & DOWNLOAD REPOSITORIES
  • Search forHome Assistant Web Proxy
  • ClickDOWNLOAD

Install the integration to your Home Assistant instance:

  • NavigateSettings -> Devices & Services
  • Click+ Add INTEGRATION
  • Search and installHome Assistant Web Proxy
  • ClickFINISH

Basic Usage

The integration does not proxy anything by default. There are two methods to actuallyproxy:

Set up static URL Proxying

With this method, the user manually configures static URL patterns to allow proxying for.

Visit the options configuration for the integration:

  • NavigateSettings -> Devices & Services
  • Click throughHome Assistant Web Proxy in the list of installed integrations
  • ClickCONFIGURE
  • Click+ ADD to add a URL pattern that should be allowed proxy through the integration(e.g.https://cam-*.mydomain.io to allow proxying any hostname that starts withcam- in themydomain.io domain)
  • ClickSUBMIT

Result:

  • If the example target to proxy ishttp://cam-back-yard.mydomain.io, first URL encodeit tohttp%3A%2F%2Fcam-back-yard.mydomain.io
  • Visitinghttps://$HA_INSTANCE/api/hass_web_proxy/v0/?url=http%3A%2F%2Fcam-back-yard.mydomain.iowill proxy through Home Assistant for authenticated Home Assistant users.

Create a dynamic URL proxy

With this method, the user, Home Assistant automation or Lovelace cards, can dynamicallyrequest a URL be proxied:

  • Call thehass_web_proxy.create_proxied_url action:
action:hass_web_proxy.create_proxied_urldata:url_pattern:https://cam-*.mydomain.iourl_id:id-that-can-optionally-be-used-to-delete-later

Result:

  • If the example target to proxy ishttp://cam-back-yard.mydomain.io, first URL encodeit tohttp%3A%2F%2Fcam-back-yard.mydomain.io
  • Visitinghttps://$HA_INSTANCE/api/hass_web_proxy/v0/?url=http%3A%2F%2Fcam-back-yard.mydomain.iowill proxy through Home Assistant for authenticated Home Assistant users.
  • The service call will return a dictionary with aurl_id parameter referringto the created proxied URL.

To delete the proxied URL:

  • Call thehass_web_proxy.delete_proxied_url action:
action:hass_web_proxy.delete_proxied_urldata:url_id:id-that-can-optionally-be-used-to-delete-later

Reference

Configuration Options

NameDefaultDescription
dynamic_urlstrueWhether to allow to creation and deletion of dynamic proxy URL targets via thehass_web_proxy.create_proxied_url andhass_web_proxy.delete_proxied_url calls respectively.
ssl_verificationtrueWhether SSL certifications/hostnames should be verified on the proxy URL targets.
ssl_ciphersdefaultWhether to usedefault,modern,intermediate, orinsecure ciphers. Older devices may not support default or modern ciphers.
url_patterns[]An optional list of staticURL patterns to allow proxying for, e.g.[ http://cam-*.mydomain.io ]

Dynamic Service Options

hass_web_proxy.create_proxied_url

action:hass_web_proxy.create_proxied_urldata:[...]
NameDefaultDescription
open_limitAn optional number of times a URL pattern may be proxied to before it is automatically removed as a proxied URL.
ssl_verificationtrueWhether SSL certifications/hostnames should be verified on the proxy URL targets.
ssl_ciphersdefaultWhether to usedefault,modern,intermediate, orinsecure ciphers. Older devices may not support default or modern ciphers.
ttlAn optional number of seconds to allow proxying of this URL pattern.
url_patternAn requiredURL pattern to allow proxying for, e.g.http://cam-*.mydomain.io.
url_id[UUID]An optional ID that can be used to refer to that proxied URL later (e.g. to delete it with thehass_web_proxy.delete_proxied_url action). A UUID is automatically used if this parameter is not specified.
allow_unauthenticatedfalseIffalse, or unset, unauthenticated HA users will not be allowed to access the proxied URL. Iftrue, they will. See below.

hass_web_proxy.delete_proxied_url

action:hass_web_proxy.delete_proxied_urldata:[...]
NameDefaultDescription
url_idAn id of a URL pattern to delete, that was previously created using thehass_web_proxy.create_proxied_url call.

Considerations

Security

No URLs are proxied by default.

However, any user, automation or Javascript with authenticated access to theHome Assistant instance could callhass_web_proxy.create_proxied_url to createa dynamically proxied URL, thus exposing arbitrary resources "behind" HomeAssistant to anything/anyone that can access Home Assistant itself.Depending on the setup, this may present an access escalation beyond what wouldusually be accessible. In particular, wide exposure could occur if the user,automation or Javascript setallow_unauthenticated in the dynamically proxiedURL request, which would allow arbitrary internet traffic to be proxied via theHome Assistant instance regardless of whether or not they have valid usercredentials on the HA instance.

Performance

All proxying is done by the integration which runs as part of the Home Assistantprocess itself. As such, this proxy is not expected to be particularlyperformant and excessive usage could slow Home Assistant itself down. This isunlikely to be noticeable in practice for casual usage.

About

Home Assistant Web Proxy

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp