URL redirect to subdomain

Hello friends, how are you?

Today we changed a lot of web systems and I need to keep the old urls.

The old url is like this:


The new url is:


So, the main idea is if I point to app folder to the old system.server.com, just redirect to app.server.com/app

My HAProxy is 1.5



Something like:
redirect prefix https://app.server.com/app if { hdr(host) -i system.server.com } { url_beg /app }

Thanks! Also I updated to the latest 1.7 version.