The pictures of all network flows in https://techzone.omnissa.com/resource/network-ports-horizon-8 will probably help.
To determine which ports actually need to be open in you environment, for your specific situation, you first have to determine what you are going to use as a remoting protocol, among other things.
Also, configuration depends on if and how you are going to load balance your uag's:
https://techzone.omnissa.com/resource/load-balancing-unified-access-gateway-horizon