I will make a try tomorrow, my first thought is similar issue to this one
Btw, if you change the line ./mylegacyapp to use curl command, does it work?