'Using 'az webapp deploy' to deploy .war file to subfolder

I have created a Linux App Service with Java8 and Tomcat 8.5 in Azure.

To that App Service I deploy a .war file using the following command:

az webapp deploy --resource-group <group-name> --name <app-name> --src-path ./geoserver.war

This all works fine. This uploads my .war file to the /home/site/wwwroot/ directory and gives the war file the name app.war by default.

Then I can access:

https://[my-site].azurewebsites.net/web

And it all works. The site loads.

But I need it to be in a subfolder, so I can navigate to something like:

https://[my-site].azurewebsites.net/geoserver/web/

So I changed my command a little by adding --target-path to it. But whatever path I try, I keep getting this error back:

502 - Web server received an invalid response while acting as a gateway or proxy server

When I remove the --target-path command, then it works fine.

My command end up looking like this:

az webapp deploy --resource-group <group-name> --name <app-name> --src-path ./geoserver.war --target-path /home/site/wwwroot/geoserver/

But, this gives me the error shown above. I've tried the following things as --target-path, but all fail with the same error:

--target-path /home/site/wwwroot/geoserver/
--target-path /home/site/wwwroot/geoserver
--target-path /home/site/wwwroot/geoserver/app.war
--target-path /geoserver/
--target-path /geoserver/app.war
--target-path home/site/wwwroot/geoserver/app.war
--target-path /site/wwwroot/geoserver/
etc..

So basically my goal is to deploy the .war file to a subfolder. What am I doing wrong here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source