To create a new instance you will send a POST request to https://nacp01.noraina.net/api/instance
Do not forget the headers:
Content-Type: application/json
x-access-token: {{token}}
(The token can be obtained via the login endpoint, which is explained here.)
The payload of this method should be something like this:
{
"name": "my_instance",
"services": [
{
"provider_region": "eu-west-2",
"provider_name": "aws",
"name": "my_service_1",
"fqdn": "my-service-1.example.com",
"origin_hostheader": "my-service-1.s3-us-west-2.amazonaws.com",
"origin_backend": "https://my-service-1.s3-us-west-2.amazonaws.com",
"secure_links": {
"enabled": true,
"secret": "someSecretPassword"
},
"cert_id": "012345678901234567890123",
"https_redirect": false,
"caching_mode": "uri",
"cache_expiration_time": 1440,
"custom_headers": [
{
"name": "header1",
"value": "value1"
},
{
"name": "header2",
"value": "value2"
}
],
"aliases": [
"www.mydomain.com",
"sub.otherdomain.net"
]
},
{
"provider_region": "us-west-1",
"provider_name": "aws",
"name": "my_service_2",
"fqdn": "my-service-2.example.com",
"origin_hostheader": "my-service-2.s3-us-west-1.amazonaws.com",
"origin_backend": "http://my-service-2.s3-us-west-1.amazonaws.com",
"cert_id": "012345678901234567890123",
"valid_referers": {
"enabled": true,
"list": [
"www.example1.com",
"*.example2.com"
]
}
}
]
}
And this is a bit of explanation about each one of the fields:
name
: Name of the new instance.services
: A list of services associated with the instance. Each service contains the following information:provider_region
: The service provider's region (e.g.,eu-west-2
).provider_name
: The service provider's name (e.g.,aws
). [Get providers and regions using the endpoint documented here.]name
: Name of the service.fqdn
: Fully Qualified Domain Name of the service.origin_hostheader
: Origin host header.
-
origin_backend
: URL of the service's backend.secure_links
: [optional] Object to configure secure links.enabled
: Specifies whether secure links are enabled (true
orfalse
).secret
: Secret used for validating secure links.
cert_id
: [optional] ID of the certificate associated with the service. [Manage certificates using the endpoint documented here.]https_redirect
: [optional] Specifies whether to force HTTPS redirection (true
orfalse
). The default is "false".caching_mode
: [optional] The caching mode, such as"uri" or "full"
. The default is "uri".cache_expiration_time
: [optional] Cache expiration time in minutes. The default is "1440" which is 24 hours.custom_headers
: [optional] A list of custom headers to add to the service.name
: Name of the header.value
: Value of the header.
aliases
: [optional] A list of domain aliases associated with the service.valid_referers:
[optional] Object to allow requests only from specific referers.- enabled: Specifies hwter valid_referers are enabled (true or false).
- list: The list of valid referers.
enhanced_big_files:
[optional] Enable or disable buffering (true or false).tls_config:
[optional] Define specific tls configuration for the service.- modes: Which tls modes does the service accept. The default is: "TLSv1 TLSv1.1 TLSv1.2"
- ciphers: Which ciphers does the service accept. The default is: "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"