Thank you for that. handle_path looks like exactly what I need. So I’ve been playing around more with this. And I think this more closely resembles what I want.
Any requests to /api/* will get reverse proxied over to localhost:3005 because that is where my node server is running and the /api will get chopped off as well. And then all other requests will get handled as a file_server at /var/www/html. That’s what I want to happen and what I think that CaddyFile should be doing. But when I click the login button, it fails. In the Headers tab I can see the login button is hitting https://example.com/api/users/login. And getting a status of 200 OK back. But in the response I see You need to enable JavaScript to run this app. which tells me it is hitting my React app at /var/www/html.
The handle directives are mutually exclusive from eachother, and are sorted using their matchers. So writing it this way, the handle without a matcher will always run last, making sure that rewrites do not happen when the path has /api/*.