Search code examples
amazon-web-servicesnginxhttp2elastic-load-balancernpn

Does AWS Elastic Load Balancer (ELB) v2 support Next Protocol Negotiation (NPN)


I'd like to use AWS Elastic Load Balancer (ELB) v2 Application Load Balancer with HTTP 2.0. I'm trying to find out if it supports Next Protocol Negotiation (NPN) which was replaced by ALPN in the official specs.

I need NPN because I have some older Android clients that require it to use HTTP 2.0. NGINX has the ability to turn on NPN without SPDY (I don't need SPDY, just NPN). Since ELB is based on NGINX, I thought it might be enabled.

Looking through the ELB docs, I can't see mention of ALPN or NPN.


Solution

  • Using curl to connect to an application load balancer instance shows it supports both NPN and ALPN.

    With no options:

    $ curl --verbose -I --http2 https://example.com 2>&1 | grep ALPN
    * ALPN, offering h2
    * ALPN, offering http/1.1
    * ALPN, server accepted to use h2
    

    Telling curl to explicitly not use ALPN:

    $ curl --no-alpn --verbose -I --http2 https://example.com 2>&1 | grep NPN
    * NPN, negotiated HTTP2 (h2)
    

    In both cases the request was served using HTTP/2.

    I tested against an application load balancer targeted to a fresh EC2 instance running nginx on port 80 (i.e., it doesn't make a difference what the backend supports).