Proxypass subfolder entries to another link

Dear Support

Currently we have nginx proxypass to tomcat service and is working fine.

server {
listen 80;
server_name app.geo.com;
location / {
if (!-e $request_filename) { rewrite ^/(.)$ /index.php?q=$1
last; } }
location /docs {
proxy_pass http://localhost:8080/officework;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
}
}
So while accessing app.geo.com/docs/
we are getting the contents of
http://localhost:8080/officework

Now we have another tomcat war folder /homework and while accessing
app.geo.com/docs/home* we need to get the contents of
http://localhost:8080/homework

That is we need as follows:

http://app.geo.com/docs/* → http://localhost:8080/officework

http://app.geo.com/docs/home/* → http://localhost:8080/homework

Can anyone please help us to configure this in our nginx.
Thanks
Geo

Posted at Nginx Forum: