Caddyfile help - Removing subdirectory / subfolder from url

Thank you Francis!

Do you have any suggestions on what may be going wrong with the handle_path directive approach? When I try the following handle_path directive:

route /qnap/* {
  uri strip_prefix /qnap
  reverse_proxy http://10.0.0.222:8080
}

I end up with http://postulat.es/redirect?count=0.19290717531145218 in my address bar. This is a step further than the normal reverse_proxy method where I get what looks like a 404 error from the QNAP server. On the upstream server itself, this server first loads a page contains the following javascript:

<html style="background:#007cef">
<head>
<meta http-equiv="expires" content="0">
<script type='text/javascript'>
pr=(document.location.protocol == 'https:') ? 'https' : 'http';
pt=(location.port == '') ? '' : ':' + location.port;
redirect_suffix = "/redirect.html?count="+Math.random();
if(location.hostname.indexOf(':') == -1)
{
location.href=pr+"://"+location.hostname+pt+redirect_suffix;
}
else	//could be ipv6 addr
{
var url = "";
url=pr+"://["+ location.hostname.replace(/[\[\]]/g, '') +"]"+pt+redirect_suffix;
location.href = url;
}
</script>
</head>
<body>
</body>
</html>

The redirect.html mentioned above contains:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="expires" content="0">
</head>
<body style='display:none;'>
</body>
<script type='text/javascript'>
function goMainPage(pass){
try{
if (document.getElementById("remindValue").checked){
var expires = new Date();
expires.setTime(expires.getTime() + 365 * 24 * 60 * 60 * 1000);
document.cookie="skip_IE_detect=1; expires="+expires.toGMTString();
}
}catch(e){

}

pr=(document.location.protocol == 'https:') ? 'https' : 'http';
pt=(location.port == '') ? '' : ':' + location.port;
redirect_suffix = "/cgi-bin/QTS.cgi?count="+Math.floor(Math.random()*1000000);
if(location.hostname.indexOf(':') == -1)
{
location.href=pr+"://"+location.hostname+pt+redirect_suffix;
}
else	//could be ipv6 addr
{
var url = "";
url=pr+"://["+ location.hostname.replace(/[\[\]]/g, '') +"]"+pt+redirect_suffix;
location.href = url;
}
}
goMainPage();
</script>
</html>

It seems that the QNAP webui does all the rest of its ‘work’ from the cgi-bin folder once redirected there, so I am hopeful that once the redirect is solved the page will work properly. The ultimate page is either http://10.0.0.222:8080/cgi-bin/QTS.cgi or http://10.0.0.222:8080/cgi-bin/login.html. I wonder is there a way to tell Caddy to go to one of those pages immediately when navigating to postulat.es/qnap?

Thanks in advance for any insights you may have.