Skip to content
Docs

Network Notice for AI Websites (Captive Portal)

When a device joins a network whose DNS points at AgentWatch, AI websites such as ChatGPT are routed through the AgentWatch gateway. A device that has not installed AgentWatch Connect does not trust the AgentWatch certificate, so the browser shows a certificate error for those sites and cannot be shown any page from us — the connection fails before a page can be sent.

The network notice closes that gap. When a device joins the network, the operating system silently checks a well-known plain-HTTP address to see whether it is online. AgentWatch answers that check, and the system opens its Sign in to network window with this message:

This network monitors AI websites. To protect data, your organization checks traffic to AI websites like ChatGPT, Claude and Gemini on this network. Other websites are not affected.

The window offers Sign in & set up, which opens your enrollment portal (/portal?org=<your org>), and Continue to internet, which closes the notice for that device.

  1. Set the public address of the gateway. Set AW_PUBLIC_BASE_URL to the https address of the gateway (for example https://gateway.example.com) on the AgentWatch app and restart it. The notice is opened by the operating system on a probe host such as captive.apple.com over plain HTTP, so the request’s own address is useless as a link target. The Sign in & set up link is built from AW_PUBLIC_BASE_URL. The portal asks for a sign-in, so AgentWatch never links it over plain HTTP or on a probe host: if AW_PUBLIC_BASE_URL is missing or starts with http://, the button is replaced by Contact your IT administrator, and the app log shows a warning naming AW_PUBLIC_BASE_URL (at most once every 10 minutes).
  2. Enable the enrollment portal for the organization: tick Enable the enrollment portal for this organization. Optionally set Company / Portal name — it is the name shown on the notice; if it is empty or left as “Your Organization”, the organization’s own name is used.
  3. Steer the probe hosts in DNS. On the AgentWatch DNS server set AGENTWATCH_DNS_CAPTIVE=1 and restart it. This adds captive.apple.com, connectivitycheck.gstatic.com, connectivitycheck.android.com, clients3.google.com, www.msftconnecttest.com, www.msftncsi.com and detectportal.firefox.com to the redirected names. dns.msftncsi.com is deliberately not steered: Windows checks that this name resolves to its real address, and steering it makes Windows report No internet access even after Continue to internet.
  4. Let port 80 reach the app for those hosts and paths only. Only the shipped haproxy-production.cfg carries this rule. haproxy-sample.cfg and docs/haproxy-agentwatch-poc.cfg redirect all of port 80 to HTTPS, so with them the probe never reaches the app and the notice never appears; copy the frontend http block below into your configuration. It sends a plain-HTTP request to the app only when both the host is a probe host and the path is a probe path or /captive/…; everything else, including /portal on a probe host, is redirected to HTTPS. On that path it also replaces X-Forwarded-Proto and removes X-Forwarded-Host and Forwarded, so a device cannot choose the scheme or host the notice links to. If you use another load balancer, apply the same rules.
  5. Map the network to the organization: open the DNS Redirector tab and add the network’s public address under Tenant gateway-IP allowlist. Or, on a single-organization deployment, set Network notice: default organization in the platform portal settings.
frontend http
bind *:80
mode http
option forwardfor
acl captive_probe hdr(host),field(1,:) -i captive.apple.com connectivitycheck.gstatic.com connectivitycheck.android.com clients3.google.com www.msftconnecttest.com www.msftncsi.com detectportal.firefox.com
acl captive_path path -i /hotspot-detect.html /library/test/success.html /generate_204 /gen_204 /connecttest.txt /ncsi.txt /success.txt /canonical.html /redirect
acl captive_path path_beg -i /captive/
http-request set-header X-Forwarded-Proto http if captive_probe
http-request del-header X-Forwarded-Host if captive_probe
http-request del-header Forwarded if captive_probe
use_backend agentwatch if captive_probe captive_path
# Redirect everything except (probe host AND probe path).
redirect scheme https code 301 if !{ ssl_fc } !captive_probe or !{ ssl_fc } !captive_path

Replace agentwatch with the name of your backend for the AgentWatch app.

The app answers these probe paths: /generate_204, /gen_204, /hotspot-detect.html, /library/test/success.html, /connecttest.txt, /ncsi.txt, /redirect, /success.txt and Firefox’s /canonical.html.

On Windows, /redirect is the page Windows opens in the browser, not a check. It keeps showing the notice even after Continue to internet, by design; the Windows network status is cleared by /connecttest.txt and /ncsi.txt.

Check it from a machine that uses the AgentWatch DNS and has not already tapped Continue to internet (otherwise you get 200 Success, which is correct):

Terminal window
curl -i http://captive.apple.com/hotspot-detect.html
# HTTP/1.1 302 Found
# Location: /captive/notice (includes the base path on path-prefixed deployments)

After clicking Continue to internet on that machine the same request returns 200 with Success. Firefox’s /canonical.html returns its own success page the same way.

If a device presses Continue to internet repeatedly, AgentWatch answers 429 Too many attempts from this network. Try again in a minute. unless the device has already been acknowledged. This appears after more than 10 taps from one address within a minute.

The notice is remembered per client address. The address is the last entry of the X-Forwarded-For header. AW_CAPTIVE_PROXY_HOPS sets how many proxies append to that header in front of the app. It defaults to the app-wide AW_TRUSTED_PROXY_HOPS (see Which client address does AgentWatch use?), which is 1: one appending proxy such as the shipped HAProxy. Set 0 when the gateway is exposed directly to devices. When the app runs under its own built-in server, the real connection address is used as a fallback.

The default 1 is safe only if devices cannot reach the app port (8787) directly. A device that can connect to 8787 itself can send its own X-Forwarded-For and pick the address that is acknowledged. Firewall 8787 so only the proxy reaches it.

An organization given as ?org= on the notice is honoured only if that organization’s enrollment portal is enabled.

How long does “Continue to internet” last?

Section titled “How long does “Continue to internet” last?”

Settings → Enrollment Portal → Network notice: show again after (minutes), default 1440 (24 hours), allowed 5 to 10080.

Situation What happens What to do
The gateway sees one shared public IP for the whole site (cloud gateway behind campus NAT) One person tapping Continue hides the notice for every device on that IP until the time runs out Use a short time (for example 60 minutes), or run the gateway where it sees device addresses
Acknowledgements are kept in memory in the app process A restart or upgrade clears them, so every device is shown the notice again. With more than one app instance behind a load balancer, an acknowledgement on one instance is unknown to another, so a device may stay captive. At most 50,000 acknowledged devices are remembered; beyond that the oldest are forgotten and re-prompted Run one app instance, or pin the probe hosts to one instance (sticky by client IP)
AW_CAPTIVE_PROXY_HOPS does not match the number of appending proxies AgentWatch reads the wrong address, so acknowledgements apply to the wrong device or to the proxy Set it to the number of proxies in front of the app (1 for the shipped HAProxy, 0 when exposed directly)
Any website can send the acknowledge request for a visitor A web page can dismiss the notice for that visitor; there is no CSRF token, by design None needed — the request only dismisses an informational notice and grants nothing
A device uses IPv6 privacy addresses The address rotates, so the device may see the notice again Expected; use a longer time if re-prompts bother people
A device uses private DNS (Chrome Secure DNS, Android Private DNS, iCloud Private Relay) It does not use your DNS, so it sees neither the notice nor the AI-site routing Block or disable private DNS on managed devices
A device skipped the notice and opens chatgpt.com The browser shows a certificate error; we cannot replace that page They can rejoin the network or open the portal link directly
No organization is found for the network, or its portal is disabled The notice shows Contact your IT administrator and your support email instead of the portal button Enable the portal and map the network IP
AW_PUBLIC_BASE_URL is not set, or is an http:// address The notice shows Contact your IT administrator instead of the portal button, and the app logs a warning Set AW_PUBLIC_BASE_URL to the https address of the gateway
Your load balancer redirects all of port 80 (as haproxy-sample.cfg does) The probe never reaches the app, so no notice appears Use the frontend http block above

What does a user see after installing Connect?

Section titled “What does a user see after installing Connect?”

If Connect is installed but the person has not signed in yet, opening an AI website shows Sign in to AgentWatch Connect to use ChatGPT (with the site’s name), a code, and a Sign in to AgentWatch button. After signing in and reloading, the site opens normally. See Organization-managed and shared computers.