Can I route on remote_ip? or if remote_ip -eq

Yep! That’s what request matchers are for:

Looks more like this:

@isLocal remote_ip 172.22.0.4
rewrite @isLocal /homeassistant/{path}

But I’m not totally certain I understand what you’re trying to achieve with the rewrite. The remote IP will be the IP address of the browser making the request, not the IP address of the server that responded to the previous request. I think with the above, the rewrite will just never apply.

Homeassistant must have configuration that lets you change its base path, so that it doesn’t make the redirects happen to the root. See this article: