Skip to content

Set Load Balancer Custom Domain

POST
/gateway/{gateway_id}/custom-domain/
curl --request POST \
--url 'https://api.e2enetworks.com/myaccount/api/v1/gpu/gateway/{gateway_id}/custom-domain/?project_id=<PROJECT_ID>&location=<LOCATION>&apikey=<API_KEY>' \
--header 'Authorization: Bearer <API_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"domain": "www.example.com",
"cert_mode": "acme",
"certificate_id": 15
}'

Adds a custom domain to an L7 Load Balancer, or replaces the one it has. The address E2E gave the Load Balancer keeps working. With cert_mode acme a free certificate is requested and is issued once the domain’s DNS points at the Load Balancer; this turns HTTP on, with redirect to HTTPS, if the Load Balancer is HTTPS only. With upload the Load Balancer serves a certificate you uploaded. Point a CNAME record for the domain at cname_target. The Load Balancer needs the Update permission.

gateway_id
required
integer

Load Balancer ID

project_id
required
integer

Project ID

active_iam
integer

Active IAM ID (To access contact person account) Find your Active IAM ID here

location
required
string
Allowed values: Delhi Chennai

Location

Media typeapplication/json
object
domain
required

The domain. Lower-cased and a trailing dot removed. Letters, digits and hyphens in labels of up to 63 characters, with at least one dot. A name under e2enetworks.net is refused.

string

Example

www.example.com
cert_mode

acme for a free certificate that renews itself, or upload to use a certificate of the project. Default acme.

string
Allowed values: acme upload

Example

acme
certificate_id

ID of the certificate to serve. Required when cert_mode is upload. It must belong to the project and cover the domain.

integer
nullable

Example

15

The custom domain as set

Media typeapplication/json
object
code
integer
message
string
data
object
domain
string
status
string
Allowed values: pending_dns issuing active failed
cname_target
string
dns_verified
boolean
reason
string
certificate

The certificate, with the fields shown in Get Load Balancer Custom Domain.

object
errors
object

Example

{
"code": 200,
"message": "Success",
"data": {
"domain": "www.example.com",
"status": "pending_dns",
"cname_target": "lb-12-abc123.e2enetworks.net",
"dns_verified": false,
"reason": ""
},
"errors": {}
}

The Load Balancer is L4 (“Custom domains apply to L7 (HTTP/HTTPS) load balancers only.”); domain is empty, is not a valid name, or is under e2enetworks.net (errors is keyed by domain); cert_mode is not acme or upload; cert_mode is upload without certificate_id; the certificate is not in the project or does not cover the domain; the domain is already used by another Load Balancer (“‘’ is already attached to another load balancer.”); or the change could not be applied (“Failed to apply the custom domain to the load balancer. Please try again.”). A missing or invalid project ID also gives 400 with errors “Project ID is missing or invalid”.

Media typeapplication/json
object
code
integer
message
string
data
object
errors
string

Example

{
"code": 400,
"message": "Bad Request",
"data": {},
"errors": "Custom domains apply to L7 (HTTP/HTTPS) load balancers only."
}

No Load Balancer with that ID in the project and region.

Media typeapplication/json
object
code
integer
message
string
data
object
errors
string

Example

{
"code": 404,
"message": "Bad Request",
"data": {},
"errors": "Gateway not found"
}