Documentation

esc
    Networking / HTTPS

    HTTPS on load balancers

    End TLS on an appliance load balancer with a free Pantech certificate, redirect HTTP to HTTPS, choose a TLS policy, and let renewals reach the load balancer by themselves.

    An appliance load balancer can end HTTPS for your site. It serves a certificate from Certificate Manager, decrypts the traffic, and passes plain HTTP to your VMs. Your VMs need no certificate and no private key.

    A VPC-native load balancer passes TCP only. It refuses https with 422 VALIDATION_FAILED on protocol, code LOAD_BALANCER_TLS_NOT_SUPPORTED. To serve HTTPS from a VPC, use TCP on port 443 and install the certificate on your servers.

    What it does

    • Ends TLS on the load balancer, and offers HTTP/2 and HTTP/1.1.
    • Speaks plain HTTP to each target on its target port (port 80 when you leave it out).
    • Adds X-Forwarded-For, X-Forwarded-Proto: https and X-Forwarded-Port to every request, so your app knows the client's address and that it came over HTTPS.
    • Optionally answers port 80 on the same address with a 301 redirect to https://, keeping the host and path.

    Before you start

    You need an issued certificate for the names your site uses. Request one for free, for example example.com and *.example.com. It does not need to be exportable: a load balancer is a Pantech service, so it can use any certificate.

    Then point the names at the load balancer's address with an A record once it is created.

    Create an HTTPS load balancer

    In the console, go to Load balancers and press Create load balancer:

    1. Load balancer type: Application Load Balancer (Layer 7), the appliance.
    2. Protocol: HTTPS.
    3. Certificate: an issued certificate. One being renewed works too.
    4. TLS policy: Modern (the default) or TLS 1.3 only. See TLS policies.
    5. Redirect HTTP to HTTPS: on by default, to also answer port 80 with a redirect.
    6. Public port: usually 443. VM port: the port your app listens on, 80 if you leave it out.
    7. The name, algorithm, allowed sources and targets, as for any load balancer.

    With the CLI:

    Terminal
    $ pantech load-balancers create --name shop --zone af-abj-1 --protocol https \    --certificate cert_01JD… --port 443 --private-port 80 \    --redirect-http --target web-1,web-2

    With the API, add the HTTPS fields to the create body:

    JSON
    {
      "name": "shop",
      "kind": "appliance",
      "zone_id": "af-abj-1",
      "protocol": "https",
      "certificate_id": "cert_01JD…",
      "tls_policy": "modern",
      "redirect_http": true,
      "public_port": 443,
      "private_port": 80,
      "instance_ids": ["vm_06gk…", "vm_07hk…"]
    }

    certificate_id, tls_policy and redirect_http are for https only. Sent on a tcp load balancer, they are refused with LOAD_BALANCER_TLS_FIELDS_NOT_ALLOWED. An https load balancer without a certificate is refused with CERTIFICATE_REQUIRED.

    TLS policies

    PolicyAllows
    modern (the default)TLS 1.2 and 1.3. TLS 1.2 only with forward-secret AEAD ciphers (ECDHE with AES-GCM or ChaCha20-Poly1305)
    tls13TLS 1.3 only

    No policy allows TLS 1.0 or 1.1. Choose tls13 when every client you serve supports it; modern also serves older browsers and devices that stop at TLS 1.2.

    Redirect HTTP to HTTPS

    With redirect_http on, port 80 on the load balancer's address answers every request with 301 to https://<host><path>. When the public port is not 443, the redirect names it, such as https://example.com:8443/.

    Port 80 is then taken by the redirect, so the HTTPS listener itself cannot be on port 80 (LOAD_BALANCER_PORT_RESERVED). The allowed sources apply to port 80 too.

    Renewals

    Pantech renews the certificate from 30 days before it expires, and the new certificate reaches every load balancer that uses it within a few minutes, with a reload that drops no connection. Nothing is needed from you. A reimported certificate reaches the load balancer the same way.

    The load balancer's certificate_fingerprint_sha256 is the certificate it serves now. When it equals the certificate's fingerprint_sha256, the load balancer serves the latest one. in_sync is false while a change, or a new certificate, is still on its way.

    Change the certificate or the policy

    On an https load balancer you can change the certificate, the TLS policy and the redirect at any time, in the console with Edit on the load balancer's page. The protocol and ports are fixed.

    Terminal
    $ pantech load-balancers update shop --certificate cert_02JD… --tls-policy tls13

    The previous certificate is released once the change is accepted.

    While a certificate is in use

    A certificate an HTTPS load balancer uses shows the load balancer in its in_use_by. It cannot be deleted or revoked while it is in use: both answer 409 CERTIFICATE_IN_USE. Switch the load balancer to another certificate, or delete the load balancer, first.

    The private key never appears in a load balancer's responses, events or logs.

    Errors

    CodeWhen
    LOAD_BALANCER_TLS_NOT_SUPPORTEDhttps on a VPC-native load balancer
    CERTIFICATE_REQUIREDhttps without a certificate
    CERTIFICATE_NOT_FOUNDNo such certificate in your organization
    CERTIFICATE_NOT_USABLEThe certificate is not issued or being renewed, or is being revoked
    LOAD_BALANCER_TLS_FIELDS_NOT_ALLOWEDHTTPS fields on a tcp load balancer
    INVALID_TLS_POLICYNot modern or tls13
    LOAD_BALANCER_PORT_RESERVEDPort 80 with the redirect on, or 8404 or 8405 on an appliance
    CERTIFICATES_UNAVAILABLECertificates are not available on this deployment

    A change can also fail after it was accepted. The operation then fails with CERTIFICATE_NOT_USABLE (the certificate was deleted or revoked meanwhile: choose another) or LOAD_BALANCER_CONFIG_REJECTED (the load balancer refused the change and kept serving its previous configuration).

    With Terraform

    main.tf
    resource "pantechdynamics_load_balancer" "shop" {
      name           = "shop"
      kind           = "appliance"
      zone_id        = "af-abj-1"
      protocol       = "https"
      certificate_id = "cert_01JD…"
      tls_policy     = "modern"
      redirect_http  = true
      public_port    = 443
      private_port   = 80
      instance_ids   = pantechdynamics_instance.web[*].id
    }

    certificate_id, tls_policy and redirect_http change in place; kind, zone_id, protocol and the ports replace the load balancer. certificate_fingerprint_sha256 is read-only.

    Billing

    HTTPS costs nothing extra. The appliance is billed as its VM, as for any appliance load balancer, and certificates are free.

    Was this page helpful?

    Updated