We forward to index.html which assumes that the static path pattern is /**. If it's been customised to /foo/** them we'll still forward to index.html and a 404 will result. We should avoid making this faulty forward.
There's an argument to be made that we should forward to foo/index.html. However, that makes things complicated when relative URLs in the index.html page are considered. As it's a forward rather than a redirect, the browser will resolve those URLs using / whereas they should be resolved using /foo/. We don't want to change it to a redirect so the safest option is to not set up the welcome page when the static path pattern has been customised.