Can trusted host settings use an IP address? I'm working with a test site installed on a server on my network. Since it's only a sandbox, it has no domain name. Drupal being installed in a sub-directory (there are several sandboxes), I access it through an address like this: http://10.156.222.145/d8

However, when I put this in the trusted host patterns, like so:

$settings['trusted_host_patterns'] = array(
    '^10\.156\.222\.145\/d8$',
    '^localhost$'
  );


I get the error message: "The provided host name is not valid for this server."

Question: is it even possible to configure these settings with an IP address, and if so how?
Yes using an IP is fine, you just need to make sure you're using a valid host name (I.e. one without the path appended):

^10\.156\.222\.145$