The Captive-Portal DHCP/RA Option informs the client that it may be behind a captive portal and provides the URI to access an API as defined by [
RFC 8908]. This is primarily intended to improve the user experience by showing the user the captive portal information faster and more reliably. Note that, for the foreseeable future, captive portals will still need to implement interception techniques to serve legacy clients, and clients will need to perform probing to detect captive portals; nonetheless, the mechanism provided by this document provides a more reliable and performant way to do so, and is therefore the preferred mechanism for captive portal detection.
Clients that support the Captive Portal DHCP option
SHOULD include the option in the Parameter Request List in DHCPREQUEST messages. DHCP servers
MAY send the Captive Portal option without any explicit request.
In order to support multiple "classes" of clients (e.g., IPv4 only, IPv6 only with DHCPv6 ([
RFC 8415]), and IPv6 only with RA), the captive network can provision the client with the URI via multiple methods (IPv4 DHCP, IPv6 DHCP, and IPv6 RA). The captive portal operator
SHOULD ensure that the URIs provisioned by each method are identical to reduce the chance of operational problems. As the maximum length of the URI that can be carried in IPv4 DHCP is 255 bytes, URIs longer than this
SHOULD NOT be provisioned by any of the IPv6 options described in this document. In IPv6-only environments, this restriction can be relaxed.
In all variants of this option, the URI
MUST be that of the captive portal API endpoint ([
RFC 8908]).
A captive portal
MAY do content negotiation (
Section 3.4 of
RFC 7231) and attempt to redirect clients querying without an explicit indication of support for the captive portal API content type (i.e., without application/capport+json listed explicitly anywhere within an Accept header field as described in
Section 5.3 of
RFC 7231). In so doing, the captive portal
SHOULD redirect the client to the value associated with the "user-portal-url" API key. When performing such content negotiation (
Section 3.4 of
RFC 7231), implementors of captive portals need to keep in mind that such responses might be cached, and therefore
SHOULD include an appropriate Vary header field (
Section 7.1.4 of
RFC 7231) or set the Cache-Control header field in any responses to "private" or a more restrictive value such as "no-store" (
Section 5.2.2.3 of
RFC 7234).
The URI
SHOULD NOT contain an IP address literal. Exceptions to this might include networks with only one operational IP address family where DNS is either not available or not fully functional until the captive portal has been satisfied. Use of IP Address certificates ([
RFC 3779]) adds considerations that are out of scope for this document.
Networks with no captive portals may explicitly indicate this condition by using this option with the IANA-assigned URI for this purpose. Clients observing the URI value "urn:ietf:params:capport:unrestricted" may forego time-consuming forms of captive portal detection.
The format of the IPv6 Captive-Portal DHCP option is shown below.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| option-code | option-len |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
. URI (variable length) .
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-
option-code:
-
The Captive-Portal DHCPv6 Option (103) (two octets).
-
option-len:
-
The unsigned 16-bit length, in octets, of the URI.
-
URI:
-
The URI for the captive portal API endpoint to which the user shouldconnect (encoded following the rules in [RFC 3986]).
See
Section 5.7 of
RFC 7227 for more examples of DHCP Options with URIs. See
Section 21.1 of
RFC 8415 for more on the format of IPv6 DHCP options.
Note that the URI parameter is not null terminated.
As the maximum length of the URI that can be carried in IPv4 DHCP is 255 bytes, URIs longer than this
SHOULD NOT be provisioned via IPv6 DHCP options.
This section describes the Captive-Portal Router Advertisement option.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length | URI .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ .
. .
. .
. .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-
Type:
-
37
-
Length:
-
8-bit unsigned integer. The length of the option (including the Type and Length fields) in units of 8 bytes.
-
URI:
-
The URI for the captive portal API endpoint to which the user should connect. This MUST be padded with NUL (0x00) to make the total option length (including the Type and Length fields) a multiple of 8 bytes.
Note that the URI parameter is not guaranteed to be null terminated.
As the maximum length of the URI that can be carried in IPv4 DHCP is 255 bytes, URIs longer than this
SHOULD NOT be provisioned via IPv6 RA options.