What settings to get web server with captive portal?

I want my ESP to broadcast a wifi when it fails to connect to the access point, but also have the web server where I can interact with the device.
Currently I have:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Hid Fallback Hotspot"
    password: "0EMiNvNFV3ME"
    ap_timeout: 10s 

captive_portal:
    
web_server:
  local: true
  include_internal: true

Not sure but I think you cannot have AP mode & Client mode at the same time.

I have configured multiple SSID’s (physical AP’s) for this situation - providing you have more then 1 which is reachable by your ESP device.

My wifi has needs to reach about 30 km more than it does to make that work.

I just tried to remove captive_portal and that seems to work.
I found that on Github for the same question and it does seem to work.
At least for now.

I guess that’s because the captive_portal is activated when WiFi mode does not work (immediately).
By removing that, your device keeps on trying to connect to the configured AP.