Wifi-Connect and BalenaHost

Hello community,
I need some guidance. I have a block which runs ngix to serve UI application running on port 80. I also have wifi-connect block. But problem is when I connect to Wifi connect access point, it opens the UI application instead of wifi connect captive UI. To work around, I changed wifi connect listening port to 8100 and opening captive UI connecting to http://192.168.42.1:8100. This works but does not seem right. Other option could be to stop UI service until wifi-connect block connects to internet. Any suggestions?

I found a workaround. I created a supervisor block and stopping the web server when no internet connection. This way wifi captive UI and web both runs on port 80 but only one is bound to external port at a time. This may sound stupid , so please let me know if you have better solution. If you are curious about the code, here it is → birdwatcher/start.sh at master · just4give/birdwatcher · GitHub