Serve HTTPS
Add an https service whose certificate {{product}} issues for names in your hosted zones and renews, optionally redirecting HTTP to HTTPS.
An https service ends TLS on the load balancer and forwards plain HTTP to the targets on the
destination port. This page covers a certificate Deutsche Cloud issues, on lb11, lb21, lb31 and
application; for your own certificate (and on dedicated), see
Use your own certificate. Replace www.example.com with your names.
Prerequisites
- Permission for
lb:AddService;lb:UpdateServiceto renew the certificate yourself. - In the console, also
lb:DescribeLoadBalancerson the load balancer; without it its page answers 404. - Every name in one of your hosted zones under DNS, delegated to the Deutsche Cloud nameservers: the
certificate is proven over DNS (DNS-01) through them, because port 80 goes to your targets.
Wildcards such as
*.example.comwork. See DNS. - For the HTTP-to-HTTPS redirect, no other service on port 80, and the https service itself not on port 80.
- On
application: at most 10 names including the platform name, none of them served by another load balancer on the fleet; the https service listens on port 443.
Add the https service
- Open Load balancers, open the load balancer, then the Services tab.
- Choose Add service.
- For Protocol, choose HTTPS. Source port moves to 443.
- For Certificate, keep Issued by Deutsche Cloud for my domains.
- For Domains, enter the names, one per line.
- Keep Redirect HTTP to HTTPS selected to have port 80 answer with a redirect, or clear it.
- For Destination port, enter the port your targets serve plain HTTP on.
- Choose Add.
The Certificate column shows Issuing, then Served within about a minute, or Failed. The console form selects the redirect; the API's default is no redirect.
dcloud lb services add lb-id --protocol https --source-port 443 --destination-port 8080 \
--domains www.example.com --domains example.com --redirect-httpPOST /lb/api/load-balancers/lb-id/services
{ "protocol": "https", "sourcePort": 443, "destinationPort": 8080,
"domains": ["www.example.com", "example.com"], "redirectHttp": true }The answer is 201 with certificateStatus: "pending". Read the load balancer until the service's
certificateStatus is active, or failed with the reason in certificateError.
resource "dcloud_lb_service" "https" {
load_balancer_id = dcloud_lb.web.id
protocol = "https"
source_port = 443
destination_port = 8080
domains = ["www.example.com"]
redirect_http = true
}With the redirect, port 80 answers every request with a permanent redirect to the same URL over
https (308 on application), and no other service can use port 80. On lb11–lb31 the service exists at the provider from the
moment its certificate is issued. On application, an https service without domains or a
certificate (API, CLI or Terraform) serves only the platform name, with the fleet's own
certificate.
Renewal
Deutsche Cloud checks its certificates daily and issues a new one when fewer than 30 days are left,
and again for a failed one. A failed issuance or renewal is also sent as an event
(Certificate Issuance Failed or Certificate Renewal Failed, source ews.lb).
To issue it again now, after fixing a zone or to retry:
- On the Services tab, choose the https service's row.
- Choose Renew now, or Try again after a failure. Neither is offered while it is being issued.
dcloud lb services renew-certificate lb-id service-idPOST /lb/api/load-balancers/lb-id/services/service-id/renew-certificate202, and the certificate is issued in the background.
Not available in Terraform. Renewing is an action, not a setting.
When it is refused
400for a name that is not in any of your hosted zones; the message names it.400This load balancer already has a service on port 443(with your port).400The HTTP-to-HTTPS redirect needs port 80, and another service already listens there; remove it first.400An https service that redirects HTTP cannot itself listen on port 80.400onapplicationover 10 names, or for a name another load balancer already serves (Already served by another load balancer on the fleet: …).400for a renewal of an uploaded certificate.