As of the time of this writing UXG 4.1 firmware is still in beta and this is not recommended on production networks. Proceed with caution!
First you'll need to make sure your UXG is firmware version 4.1 or newer
Your UniFi Network server also needs to be running version 9 or later, if it isn't you can contact us to get it upgraded for you
At the time of this writing, UXG 4.1 is still in beta so you will need to manually upgrade to the beta firmware which you can find here https://community.ui.com/releases/UniFi-Gateways-4-1-8/5f9fefe3-3557-4f62-b754-fb4ff7980d5c
You need to be logged in and be an Early Access user to view that post, you can enroll in Early Access in your UI account at https://account.ui.com/profile
Next, copy the link to the firmware for your device model. You will use the link to upgrade the firmware, the firmware file itself is not needed.
Then you will use this link to manually upgrade the firmware on the UXG within UniFi. We have a guide here on how to do that: https://support.hostifi.com/en/articles/9953251-unifi-how-to-upgrade-firmware-on-a-unifi-ap
Check the "Manually via the UniFi Network Controller" section.
Once that is done you will see an option to "Click to upgrade" to the New Zone-Based Firewall under Settings > Security > Traffic & Firewall Rules
UniFi Network may crash and restart after clicking Upgrade but after a reboot try again if that happens and it should work the second time
For more info about the UniFi zone-based firewalls check Ubiquiti's article here: https://help.ui.com/hc/en-us/articles/115003173168-Zone-Based-Firewalls-in-UniFi
Also here is Ubiquiti's guide on how to migrate: https://help.ui.com/hc/en-us/articles/28223082254743-Migrating-to-Zone-Based-Firewalls-in-UniFi