Why doesn't HandOff work when connected to VPN and is there a way to go around it? I have noticed that HandOff between mac and iPhone doesn't work when connected to VPN.

Steps to reproduce when using ExpressVPN:


install ExpressVPN native client on mac, connect to local wifi, then to VPN server, take note of server
install ExpressVPN native client on iPhone, connect to same wifi, then to same VPN server
try HandOff of webpage from Safari in iPhone to Safari in mac -> doesn't work, Safari on mac displays message "opening webpage from HandOff" but page doesn't load (stays blank, no 404 or other error shown)
disconnect from VPN in both mac and iPhone and retry same experiment -> Safari opens the page without problems


Actually, how does HandOff work under the hood? It seems to require both Bluetooth and Wifi. I guess Bluetooth is being used for the transfer itself while Wifi is used to check connection to iCloud.
https://support.apple.com/en-us/HT204681
I contacted ExpressVPN support and got some answers.


They have a security feature that prevents port forwarding between different devices connected independently to the VPN
A solution would be to connect both devices (mac and iPhone) to the router and connect the router directly to the VPN, in this way both devices share the same connection and can "see" each other