The reason of this is that AM gets the proxy URI from config yarn.web-proxy.address, and if it does not exist, it will get the URI from yarn.resourcemanager.webapp.address.
But in federation, we don't know which RM will be the home cluster of an application, so I do this fix:
1. Add this config in the yarn-site.xml on client.
2. Change the way to get the config from Configuration#get to Configuration#getStrings in WebAppUtils#getProxyHostsAndPortsForAmFilter.
So that I can access the AM page now.
This config needs to be added in the client side, so it will affect application only.
Before fixing， click the AM link in RM or Router：
And after the fix, we can access the AM page as normal...