Fact-checked by Grok 2 weeks ago

Application-Layer Protocol Negotiation

Application-Layer Protocol Negotiation (ALPN) is a (TLS) extension that enables the negotiation of application-layer protocols during the TLS handshake, allowing clients and servers to agree on the protocol to use—such as HTTP/1.1 or —over a single secure connection without additional round trips. Defined in RFC 7301 and published by the (IETF) in July 2014, ALPN addresses the challenge of multiplexing multiple application protocols on the same transport port, particularly port 443 for traffic, thereby improving efficiency and enabling protocol-specific optimizations like certificate selection. It replaces the earlier, non-standard Next Protocol Negotiation (NPN) mechanism, providing a standardized, IANA-registered framework for protocol identifiers as opaque byte strings. In practice, the client advertises a prioritized list of supported protocols in the ClientHello message using the ALPN extension (TLS extension type 16), and the server responds by selecting one protocol in the ServerHello if supported, ensuring both parties proceed with the chosen atop the established TLS session. This integration with TLS 1.2 or higher is mandatory for secure deployments of protocols like , where the "h2" identifier must be used via ALPN to confirm mutual support and mitigate cross-protocol attacks. ALPN's adoption has been pivotal in modern web infrastructure, supporting the transition to multiplexed protocols and extending to other domains such as Web Real-Time Communication (WebRTC) with identifiers like "webrtc" and secure RADIUS authentication. Its role in reducing latency and enhancing security continues to influence evolutions like HTTP/3 over QUIC, where similar negotiation principles apply.

Introduction

Definition and Purpose

Application-Layer Protocol Negotiation (ALPN) is a (TLS) extension defined in 7301, enabling clients and servers to negotiate the application-layer protocol to be used within a TLS connection before the completes. This mechanism allows the to indicate preferred protocols during the initial TLS exchange, ensuring that the selected protocol is securely agreed upon without requiring additional post-handshake negotiations. The primary purpose of ALPN is to reduce associated with selection and upgrades, such as transitioning from HTTP/1.1 to , by avoiding extra round trips that would otherwise be needed after establishing the TLS connection. It facilitates multiplexing multiple application over the same port, typically port 443 for , while maintaining secure negotiation entirely within the encrypted TLS framework. By integrating this negotiation into the TLS process, ALPN prevents mismatches that could lead to connection failures or insecure fallbacks. Key benefits include enhanced performance for through efficient protocol selection and with clients or servers that do not ALPN, as the extension can be ignored without disrupting the TLS handshake. Although ALPN operates at the , it integrates into TLS at OSI layer 6 (the ), bridging transport security with higher-level protocol choices.

Relation to TLS Handshake

Application-Layer Protocol Negotiation (ALPN) is integrated into the Transport Layer Security (TLS) handshake as an extension that enables protocol selection during the initial exchange of messages. Specifically, the client includes the ALPN extension, identified by type 16 ("application_layer_protocol_negotiation"), in its ClientHello message, containing a list of supported application protocols in order of client preference. The server, upon receiving the ClientHello, selects the most preferred protocol from the list that it supports and includes this single selected protocol in the corresponding ALPN extension within its ServerHello message, thereby confirming the chosen protocol for the connection. This process ensures that the application-layer protocol is negotiated efficiently without requiring additional round trips beyond the standard TLS handshake. ALPN requires TLS version 1.2 or later for full support, as it relies on the extension framework defined in TLS 1.2 (RFC 5246), and is not available in earlier protocols such as SSL 3.0 or TLS 1.0/1.1 without non-standard extensions. In TLS 1.2 and below, the protocol identifiers are sent in plaintext within the handshake messages, while in TLS 1.3, they are protected by encryption as part of the Encrypted Extensions message. Although the TLS extension mechanism was introduced earlier in RFC 3546 for TLS 1.0, ALPN's specification in RFC 7301 aligns it primarily with TLS 1.2 and subsequent versions for interoperability and security. If the server does not support any of the protocols proposed by the client, it must issue a fatal "no_application_protocol" alert (code 120) and terminate the handshake, preventing fallback to a default protocol as no such mechanism is defined in the ALPN specification. Unlike post-handshake negotiation approaches, such as those in some encrypted client hello extensions, ALPN completes its protocol selection by the end of the ServerHello phase, ensuring the agreed protocol is established before any application data is exchanged following the Finished messages. This timing integrates seamlessly with the TLS security model, allowing immediate application-layer communication upon handshake completion.

Technical Mechanism

Negotiation Process

The Application-Layer Protocol Negotiation (ALPN) extension integrates protocol selection directly into the (TLS) handshake, allowing clients and servers to agree on an application-layer protocol without additional network delays. In the initial phase, the client initiates negotiation by including the ALPN extension in its ClientHello message. This extension contains a ProtocolNameList, which is an ordered sequence of protocol identifiers supported by the client, listed in descending order of preference. For instance, a client might advertise "h2,http/1.1" to indicate a preference for over HTTP/1.1. The order of this list explicitly signals the client's priorities, enabling the server to select the most preferred mutually supported option. Upon receiving the ClientHello, the server examines the ProtocolNameList and determines if it supports any of the advertised s. If a match exists, the server selects the highest-priority protocol from the client's that it can handle and includes the ALPN extension in its ServerHello message, specifying the chosen protocol identifier. This selection binds the protocol to the ensuing TLS session. However, if the server supports none of the client's proposed protocols, it must terminate the by sending a fatal "no_application_protocol" alert (AlertDescription 120), preventing further connection establishment. In cases where the server chooses not to participate in ALPN—by omitting the extension from the ServerHello—no is explicitly negotiated, and the client must proceed by assuming a default or fallback application suitable for the . Clients are required to handle such absences gracefully, typically reverting to a baseline like HTTP/1.1 for , ensuring compatibility without aborting the session. Once the TLS handshake completes, the selected (or fallback) remains definitive for the ; ALPN does not permit renegotiation of the application after this point, avoiding potential risks and maintaining efficiency. A key advantage of embedding ALPN within the TLS handshake is its elimination of extra round trips that would otherwise be needed for application-layer post-encryption, streamlining the overall connection setup compared to separate discovery mechanisms. This client-offered, server-selected model ensures orderly preference resolution while integrating seamlessly with the TLS framework's security properties.

Extension Format and Identifiers

The Application-Layer Protocol Negotiation (ALPN) extension is identified by the value in the TLS extensions space, as registered with the (IANA). In the ClientHello message, the ALPN extension data consists of an opaque vector known as the ProtocolNameList, which encodes a length-prefixed list of protocol names in the client's order of preference. This structure is defined as a sequence of ProtocolName entries, where each ProtocolName is an opaque byte string of 1 to 255 bytes, prefixed by its length (1 to 255 octets). The overall ProtocolNameList length ranges from 2 to 65,535 bytes to fit within TLS message constraints, ensuring no empty or truncated names are permitted. For the ServerHello message, the ALPN extension data similarly uses a ProtocolNameList but contains exactly one ProtocolName entry, representing the single selected by the server from the client's offered list. This selected name must match one proposed by the client exactly and must be non-empty; the server omits the extension entirely if no compatible is available. Protocol identifiers, or ProtocolName values, are registered strings maintained in the IANA "TLS Application-Layer Protocol Negotiation (ALPN) Protocol IDs" registry, which operates under an Expert Review policy to ensure specifications are publicly available and documented. These identifiers are opaque byte strings encoded in , typically short ASCII sequences without wildcards or special characters, such as "http/1.1" for HTTP/1.1 (hex: 0x68 0x74 0x74 0x70 0x2f 0x31 0x2e 0x31) or "h2" for over TLS (hex: 0x68 0x32). No is applied to these identifiers, preserving their exact byte representation. The server must select precisely one matching or decline the by sending a "no_application_protocol" (value 120), resulting in failure if the selection is invalid or absent when required. The total length of the ALPN extension is constrained by the underlying TLS message size limits, typically up to 2^16-1 bytes for extensions in aggregate.

Historical Development

Next Protocol Negotiation

Next Protocol Negotiation (NPN) was introduced by in January 2010 through an IETF draft authored by Adam Langley, aimed at enabling the selection of application-layer protocols, such as the experimental protocol, over existing TLS connections on port 443 without requiring additional TCP handshakes or port allocations. The design sought to multiplex multiple protocols efficiently while allowing fallback to standard HTTP for incompatible intermediaries, and it was implemented in early versions of to facilitate deployment as a precursor to HTTP/2. The negotiation process operated as a TLS extension rather than a full handshake modification. The client advertised support by including the next_protocol_negotiation extension in its ClientHello message (with empty extension data), prompting the server to respond in the ServerHello with an unencrypted list of supported protocols encoded as length-prefixed strings. After sending its ChangeCipherSpec but before its Finished message, the client sent an EncryptedExtensions message specifying the chosen protocol. This separation ensured the final selection was encrypted but left the server's capabilities visible during the initial phase. NPN's design exhibited key limitations that undermined its reliability and security. The unencrypted protocol list in the ServerHello exposed server capabilities to potential eavesdroppers or network intermediaries, facilitating traffic discrimination—particularly problematic for privacy-focused protocols like those used in networks. Additionally, the mechanism was incompatible with TLS session resumption, as protocol selection applied only to new full handshakes and could not be preserved in abbreviated ones, leading to inconsistent behavior across connections. These issues rendered NPN inefficient for widespread adoption. These flaws, including vulnerability to analysis and resumption incompatibilities, prompted its deprecation in favor of a more integrated approach. Google announced intentions to phase out NPN from Chrome and its servers by late 2014, with full removal occurring in Chrome version 51 in May 2016 after a brief disablement trial in 2015.

Standardization of ALPN

The development of Application-Layer Protocol Negotiation (ALPN) began within the IETF Transport Layer Security (TLS) Working Group in 2012, primarily to address the limitations of the proprietary Next Protocol Negotiation (NPN) extension, which lacked standardization and broad interoperability. An initial individual draft, draft-friedl-tls-applayerprotoneg-00, was published on October 15, 2012, proposing a standardized TLS extension for negotiating application-layer protocols during the handshake. The Working Group adopted the draft, leading to the first WG version, draft-ietf-tls-applayerprotoneg-01, released on April 25, 2013. This progression involved iterative reviews, including WG last calls and IESG evaluations, to refine the extension's format, security considerations, and integration with existing TLS mechanisms. ALPN achieved formal standardization with the publication of 7301 on July 11, 2014, as a Proposed Standard by the IETF. Titled " (TLS) Application-Layer Protocol Negotiation Extension," the defines ALPN as a client-initiated extension in the TLS ClientHello message, enabling servers to select from a list of proposed protocols without additional round trips. It explicitly obsoletes NPN by providing a standards-track alternative that ensures compatibility across implementations. Following its initial publication, ALPN saw integration into subsequent TLS versions without substantive modifications to its core mechanism. In TLS 1.3, specified in RFC 8446 (published August 2018), ALPN remains a supported extension for protocol selection, maintaining its role in the streamlined while benefiting from TLS 1.3's enhanced security features. Minor clarifications have been issued via errata to RFC 7301, addressing issues such as protocol identifier formatting and registry procedures, but these do not alter the protocol's functionality. ALPN's standardization has influenced related protocols, mandating its use in specific contexts for . For instance, RFC 7540 (May 2015), which defines , requires ALPN with the "h2" identifier for TLS-secured connections to ensure proper negotiation. More recently, RFC 8833 (January 2021) specifies dedicated ALPN labels, such as "webrtc" and "c-webrtc," for Web Real-Time Communication () to facilitate secure media sessions over DTLS.

Adoption and Support

Cryptographic Libraries

OpenSSL has supported the Application-Layer Protocol Negotiation (ALPN) extension since version 1.0.2, released on January 22, 2015, which introduced the necessary and command-line options for protocol advertisement during TLS handshakes. Full integration with TLS 1.3, including seamless ALPN handling in post-handshake scenarios, was achieved in 3.0, released on September 7, 2021, enabling robust support for modern protocols like and . implemented ALPN starting with version 3.2.0, released on May 10, 2013, providing initial support for the extension in both client and server modes to facilitate protocol selection over TLS. Enhancements in version 3.8, released in February 2023, improved handling of the "h3" protocol identifier for , optimizing QUIC-based negotiations and ensuring compatibility with emerging transport protocols. BoringSSL, Google's fork of , has included native ALPN support since its initial release in June 2014, inheriting and extending the extension's functionality for high-performance environments. Widely used in and production services, BoringSSL accommodates interactions between ALPN and Encrypted Client Hello (ECH) as outlined in 2025 IETF drafts, maintaining protocol negotiation integrity amid privacy enhancements. Among other notable libraries, Mozilla's Network Security Services (NSS) added ALPN support in version 3.15.5, released in February 2014, with APIs for enabling the extension via socket options like SSL_ENABLE_ALPN. The Java Secure Socket Extension (JSSE), part of Oracle's JDK, introduced ALPN APIs in JDK 8u60, released in August 2015, allowing developers to specify protocol lists for negotiation. This support has matured in subsequent LTS releases, such as JDK 21, released in September 2023, with refined handling for TLS 1.3 and extended protocol identifiers. In practical deployments, AWS IoT Core relaxed its ALPN requirement in October 2024, allowing connections without the extension for certain constrained devices while preserving security for others. No major changes to ALPN implementations occurred in cryptographic libraries between 2023 and 2025; however, post-quantum TLS 1.3 drafts from the IETF continue to reference ALPN without modifications, focusing instead on hybrid key exchanges.

Browsers and Web Servers

Google Chrome and Microsoft Edge, both based on the Chromium engine, have supported ALPN for HTTP/2 negotiation since version 40 in April 2015, with full stable implementation by version 41 later in 2015. Mozilla Firefox introduced ALPN support for HTTP/2 starting with version 27 in 2014, becoming enabled by default in version 36 in 2015. Apple Safari added ALPN for HTTP/2 in iOS 9 and macOS 10.11, both released in 2015. By 2023, all major browsers—Chrome, Edge, Firefox, and Safari—had integrated support for the "h3" ALPN identifier to enable HTTP/3 over QUIC, with widespread deployment in stable releases. As of November 2025, HTTP/3 ("h3") support via ALPN is used by approximately 41% of websites, reflecting growing adoption alongside HTTP/2. On the server side, has supported ALPN for since version 1.9.5, released in 2015, requiring 1.0.2 or later for the extension. The followed suit with ALPN integration for via the mod_http2 module starting in version 2.4.12, also in 2015. All major web servers, including and , now mandate ALPN for and subsequent protocols like , as it is essential for efficient TLS handshake negotiation. Adoption of ALPN in browsers reached near-universal levels among modern clients by 2020, with over 95% of browser traffic capable of negotiating via ALPN, driven by performance gains in and header . Servers like enforce ALPN for connections to optimize edge performance, reducing latency in high-traffic scenarios. Post-2023, there has been no decline in ALPN support across browsers and servers; instead, it remains a foundational for advanced protocols. The ongoing development of Encrypted Client Hello (ECH), approved for publication as an RFC in 2025, maintains ALPN visibility in the outer TLS handshake to ensure compatibility with existing infrastructure while encrypting sensitive inner details. This design preserves seamless protocol negotiation without disrupting browser-server interoperability up to 2025.

Applications and Examples

HTTP Negotiation

In HTTP protocol selection, Application-Layer Protocol Negotiation (ALPN) enables clients and servers to agree on the HTTP version during the TLS handshake, optimizing web traffic efficiency. For instance, a client supporting both and HTTP/1.1 typically offers the ALPN protocol identifiers "" followed by "http/1.1" in order of preference, allowing the server to select "" if it supports 's capabilities, which reduce through concurrent request handling over a single connection. HTTP/3 further integrates ALPN by using the "h3" identifier over QUIC, a UDP-based transport that replaces TCP to mitigate head-of-line blocking. During the initial TLS 1.3 handshake within QUIC's connection establishment, the client proposes "h3" via ALPN, and the server selects it to enable HTTP/3's enhanced performance for unreliable networks. A typical ALPN handshake for HTTP negotiation appears as follows in the TLS messages:
  • ClientHello ALPN extension: The ProtocolNameList might include 0x02 0x68 0x32 (length 2, "h2") followed by 0x08 0x68 0x74 0x74 0x70 0x2f 0x31 0x2e 0x31 (length 8, "http/1.1"), prefixed by the total list length.
  • ServerHello ALPN extension (if selecting HTTP/2): 0x02 0x68 0x32 (length 2, "h2").
This wire format ensures compact negotiation without additional round trips. The primary benefits of ALPN in HTTP include serving multiple versions on the same (typically 443) without relying on HTTP headers, which would otherwise require an extra round trip and expose the connection to intermediate proxies. ALPN is explicitly required for over TLS per the specification, as connections without it default to HTTP/1.1. In practice, if ALPN is absent or unsupported, endpoints fall back to HTTP/1.1, though modern servers prioritize ALPN selection for its efficiency in enabling advanced features like .

Other Protocols

Beyond HTTP, ALPN facilitates protocol negotiation in various real-time communication and messaging systems. In , which enables peer-to-peer audio, video, and data exchange, the ALPN label "webrtc" identifies sessions using DTLS for (SRTP) key establishment and SCTP over DTLS for data channels. This label, defined in RFC 8833, allows endpoints to agree on WebRTC-specific transport before full media negotiation begins. In (IoT) environments, ALPN supports lightweight protocols like for publish-subscribe messaging over constrained networks. The IANA-registered "" identifier enables TLS-secured MQTT connections, allowing devices to negotiate the protocol during the TLS handshake. In 2024, AWS IoT Core updated its endpoint configurations to make the TLS ALPN extension optional, accommodating devices without requiring modifications for migration to cloud-based MQTT brokers. For remote procedure calls in distributed systems, commonly employs the "h2" ALPN label to negotiate as its , enabling efficient multiplexing and streaming in architectures. This standard usage aligns with 's TLS requirements, though custom protocols built on may incorporate proprietary ALPN identifiers for specialized in enterprise environments. Emerging applications of ALPN appear in post-quantum cryptography transitions, where 2025 IETF drafts for hybrid in TLS 1.3 preserve ALPN to provide hints alongside combined classical and post-quantum algorithms, ensuring during crypto-agility upgrades. As of November 2025, the IANA TLS ALPN ID registry lists 54 identifiers, including "" for to secure domain resolution queries.

References

  1. [1]
    RFC 7301 - Transport Layer Security (TLS) - IETF Datatracker
    RFC 7301 is a TLS extension for application-layer protocol negotiation, allowing the application layer to negotiate which protocol to use during the TLS ...
  2. [2]
    RFC 7540 - Hypertext Transfer Protocol Version 2 (HTTP/2)
    This specification describes an optimized expression of the semantics of the Hypertext Transfer Protocol (HTTP), referred to as HTTP version 2 (HTTP/2).
  3. [3]
    RFC 9765: RADIUS/1.1: Leveraging Application-Layer Protocol ...
    This document defines an Application-Layer Protocol Negotiation (ALPN) [RFC7301] extension for RADIUS over (D)TLS that removes the need to use MD5 for (D)TLS.<|control11|><|separator|>
  4. [4]
  5. [5]
  6. [6]
  7. [7]
  8. [8]
    Transport Layer Security (TLS) Extensions
    ### Extracted List of Registered ALPN Protocol IDs
  9. [9]
  10. [10]
    draft-agl-tls-nextprotoneg-00 - IETF Datatracker
    ... draft-agl-tls-nextprotoneg-00 Abstract This document describes a Transport ... Internet-Draft TLS Next Protocol Negotiation January 2010 publication of this ...
  11. [11]
    draft-agl-tls-nextprotoneg-04 - IETF Datatracker
    The Next Protocol Negotiation extension (NPN) is currently used to negotiate the use of SPDY [spdy] as an application level protocol on port 443.
  12. [12]
    NPN and ALPN (20 Mar 2013) - ImperialViolet
    Mar 20, 2013 · NPN allows a TLS connection to negotiate which application-level protocol will be running across it. NPN allows SPDY to be enabled efficiently.<|control11|><|separator|>
  13. [13]
    API Deprecations and Removals in Chrome 51 | Blog
    Apr 19, 2016 · During the standardization process, NPN was replaced with ALPN, published as RFC 7301 in July 2014. We intend to remove NPN at the same time as ...Missing: disable | Show results with:disable
  14. [14]
    RFC 7301 - Transport Layer Security (TLS) Application-Layer ...
    Mar 21, 2024 · Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension (RFC 7301, July 2014)
  15. [15]
    RFC Errata Report » RFC Editor
    RFC 7301, "Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension", July 2014. Note: This RFC has been updated by RFC 8447 · Source of ...
  16. [16]
    [gnutls-help] gnutls 3.2.0 - GnuPG and GNUTLS Mailing List Archives
    May 10, 2013 · Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]. Hello, I've just released gnutls 3.2.0. This release ... (ALPN) extension ...
  17. [17]
  18. [18]
    [PDF] New JDK Security Features and Performance Improvements Sean ...
    Oct 28, 2015 · • Extend the JSSE API and implementation to support DTLS (RFCs. 4347 and 6347). • TLS must run over a reliable transport channel such as TCP.
  19. [19]
    AWS IoT Core removes TLS ALPN requirement and adds custom ...
    AWS IoT Core removes TLS ALPN requirement and adds custom authorizer capabilities. Posted on: Oct 3, 2024. Today, AWS IoT Core announces three ...Missing: relaxed | Show results with:relaxed
  20. [20]
    Post-Quantum Cryptography Recommendations for TLS-based ...
    Sep 18, 2025 · Tschofenig Expires: 22 March 2026 H-BRS 18 September 2025 Post-Quantum ... Draft PQC Recommendations for TLS-based Applic September 2025 4.Missing: ALPN | Show results with:ALPN
  21. [21]
    Networking/Archive/http2 - Mozilla Wiki
    Jul 4, 2022 · HTTP/2 for Firefox is currently under development. HTTP/2 draft support is included in routine builds of firefox, enabled by default in firefox 34 and later.
  22. [22]
    HTTP/2 guide - Apache HTTP Server Version 2.4
    Almost all modern browsers support HTTP/2, but only over SSL connections: Firefox (v43), Chrome (v45), Safari (since v9), iOS Safari (v9), Opera (v35), Chrome ...
  23. [23]
    Examining HTTP/3 usage one year on - The Cloudflare Blog
    Jun 6, 2023 · HTTP/1.1 and HTTP/2 use TCP as a transport layer and add security via TLS. HTTP/3 uses QUIC to provide both the transport layer and security.Http/3 Use By Desktop... · Search Indexing Bots · Social Media Bots
  24. [24]
    Module ngx_http_v2_module - nginx
    The ngx_http_v2_module module (1.9.5) provides support for HTTP/2. This module is not built by default, it should be enabled with the --with-http_v2_module ...Example Configuration · http2_max_field_size
  25. [25]
    How to Setup Nginx HTTP/2 - KeyCDN Support
    Oct 4, 2018 · How to setup Nginx HTTP/2# · To run HTTP/2 on Nginx you must use Nginx version 1.9.5 or later. · Ensure that your site uses SSL/TLS encryption.
  26. [26]
    HTTP/2 | 2020 | The Web Almanac by HTTP Archive
    Dec 9, 2020 · Timeseries chart of HTTP/2 usage showing adoption at 64% for both desktop and mobile as of July 2019. The trend is growing steadily at about 15 ...
  27. [27]
    HTTP/2 is here! Goodbye SPDY? Not quite yet - The Cloudflare Blog
    Dec 3, 2015 · Today CloudFlare is introducing HTTP/2 support for all customers using SSL/TLS connections, while still supporting SPDY.Missing: enforcement | Show results with:enforcement
  28. [28]
    HTTP | 2024 | The Web Almanac by HTTP Archive
    Dec 10, 2024 · In this chapter, we will first look at the current state of HTTP/1.1, HTTP/2 and HTTP/3 adoption, and how their usage has evolved over time.Discovering Http/3 Support · Higher-Level Browser Apis · Resource Hints<|separator|>
  29. [29]
    Encrypted Client Hello Approved for Publication - Feisty Duck
    Jul 31, 2025 · The base specification supports parameters for ALPN as well as IPv4 and IPv6 address hints. Because the design is extensible, ECH added its ...
  30. [30]
  31. [31]
  32. [32]
    Application-Layer Protocol Negotiation (ALPN) for WebRTC
    This document specifies two Application-Layer Protocol Negotiation (ALPN) labels for use with Web Real-Time Communication (WebRTC).<|control11|><|separator|>