The basic workflow at Gateway side is inspecting all HTTP port 80 traffic (with iptables or others), If the URL is about internet detection, reply a 301 redirect to the captive portal URL.
But the URL is too complex among different vendor:
https://captivebehavior.wballiance.com/
I don't know why, even I tracked the URLs, sometimes it still fails (OS refuse connecting to the URL?).
DHCP option 114 (RFC8908) can advertise the URL to client directly, but it is not widely supported: