Help with tomcat reverse proxy

You could try this:

{
	debug
	http_port 8080
	https_port 8443
}

:8443 {
	tls /my_home/certs/server.pem /my_home/certs/server.key
	encode zstd gzip

	handle_path /apps* {
		reverse_proxy localhost:8888
	}

	handle {
		root * /my_home/web
		templates
		file_server browse
	}
}

Using handle blocks makes sure that reverse_proxy and file_server routes are mutually exclusive. And handle_path has built-in uri strip_prefix logic.

That was because /apps doesn’t match /apps/* because your matcher expects at least a slash after /apps.

It’s worth mentioning though, not all backend apps are properly set up for, or configured to handle requests to a different base path. See this article for additional reading on the topic: