Edit Service
This API is used to edit website acceleration service.
Request
Request-Line
PUT /cdn/v1.0/service/{serviceId} HTTP/1.1
Request Parameters
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| serviceId | Integer | Mandatory | Service id. |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| origins | Array | Mandatory | List of origin servers. At least one origin is required. For multiple origins, the order determines the priority (the first one is primary, subsequent ones are fallbacks). See Origin for details. |
| defaultHostHeader | String | Mandatory | Specifies the default host header and SNI when no explicit host header or SNI is configured. preserve: Maintains the host header and SNI from the original request. originHost: Uses the host from the origin URL. |
| alternateDomainNames | Array | Optional | List of alternate domain names for the service. |
| streaming | Boolean | Optional | Whether to combine multiple client requests to a single request to the origin server. true: Enabled, false: Disabled. Default is false. |
| http2 | Boolean | Optional | Enable HTTP/2 protocol. Default is true. |
| http3 | Boolean | Optional | Enable HTTP/3 protocol. Default is false. |
| redirectHttpToHttps | Boolean | Optional | Whether to redirect all HTTP requests to HTTPS. Default is false. |
| tlsProfile | String | Optional | TLS security profile. modern: TLS 1.3 only, highest security, no backward compatibility. intermediate: Recommended for most services, compatible with modern clients. old: Maximum compatibility, use only for legacy client support. |
| enabled | Boolean | Optional | Whether the service is enabled. Default is true. |
Object: Origin
| Property name | Type | Required | Description |
|---|---|---|---|
| originUrl | String | Mandatory | Origin service address. Format: [http[s]://]hostname[:port][/path/prefix]. If scheme is specified, it is forced for all origin requests. If omitted, the client's protocol is used. |
| sni | String | Optional | The server name to send to the origin during SSL handshake. |
| headers | Object | Optional | The Origin Headers containing extra headers to send to the origin. |
| s3Credential | Object | Optional | Configure the S3 credential. See S3Credential for details. |
Object: S3 Credential
| Property name | Type | Required | Description |
|---|---|---|---|
| accessKey | String | Mandatory | Configure the AWS access key ID to generate the signature to access S3. |
| accessSecret | String | Mandatory | Configure the AWS access secret to generate the signature to access S3. |
| region | String | Mandatory | Configure the AWS region (e.g., ap-southeast-1). |
| dropQueryString | Boolean | Optional | Drop the query string from the origin generating the signature to it. Default is false. |
Response
Response Body
| Property name | Type | Description |
|---|---|---|
| id | Integer | Unique service identifier. |
| domainName | String | Primary domain name for acceleration. |
| origins | Array | List of origin servers. At least one origin is required. For multiple origins, the order determines the priority (the first one is primary, subsequent ones are fallbacks). See Origin for details. |
| defaultHostHeader | String | Specifies the default host header and SNI when no explicit host header or SNI is configured. preserve: Maintains the host header and SNI from the original request. originHost: Uses the host from the origin URL. |
| alternateDomainNames | Array | List of alternate domain names for the service. |
| streaming | Boolean | Whether to combine multiple client requests into a single request to the origin server. true: Enabled, false: Disabled. Default is false. |
| http2 | Boolean | Enable HTTP/2 protocol. Default is true. |
| http3 | Boolean | Enable HTTP/3 protocol. Default is false. |
| redirectHttpToHttps | Boolean | Whether to redirect all HTTP requests to HTTPS. Default is false. |
| tlsProfile | String | TLS security profile. modern: TLS 1.3 only, highest security, no backward compatibility. intermediate: Recommended for most services, compatible with modern clients. old: Maximum compatibility, use only for legacy client support. |
| enabled | Boolean | Whether the service is enabled. Default is true. |
Status Codes, Error Codes and Error Messages
| Status Code | Error Code | Error Message |
|---|---|---|
| 400 | InvalidCustomer.IdEmpty | Customer ID cannot be empty. |
| 400 | InvalidService.IdIncorrect | Service ID is invalid. |
| 400 | InvalidService.Empty | Service cannot be empty. |
| 400 | InvalidService.OriginsEmpty | Origins cannot be empty. |
| 400 | InvalidService.OriginEmpty | Origin cannot be empty. |
| 400 | InvalidService.OriginUrlEmpty | Origin URL cannot be empty. |
| 400 | InvalidService.S3CredentialAccessKeyEmpty | S3 access key cannot be empty. |
| 400 | InvalidService.S3CredentialAccessSecretEmpty | S3 access secret cannot be empty. |
| 400 | InvalidService.S3CredentialRegionEmpty | S3 region cannot be empty. |
| 400 | InvalidService.DefaultHostHeaderEmpty | Default host header cannot be empty. |
| 400 | InvalidService.DefaultHostHeaderInCorrect | Default host header value is invalid. |
| 400 | InvalidService.TLSProfileInCorrect | TLS profile value is invalid. |
| 404 | InvalidService.NotFound | Service cannot be found. |
| 409 | InvalidService.DomainName | Domain name already exists. |
Examples
Edit Service
Request
PUT /cdn/v1.0/services/228622 HTTP/1.1
{
"streaming": true,
"http2": true,
"http3": false,
"redirectHttpToHttps": true,
"enabled": true,
"tlsProfile": "modern",
"origins": [
{
"originUrl": "https://origin1.example.com",
"sni": "origin-sni.example.com",
"headers": {
"X-Custom-Header": "test-value",
"X-Forwarded-For": "client-ip"
},
"s3Credential": {
"accessKey": "AKIAEXAMPLE123456",
"accessSecret": "secret1234567890abcdefghijklmnopqrstuvwxyz",
"region": "us-east-1",
"dropQueryString": false
}
}
],
"defaultHostHeader": "originHost",
"alternateDomainNames": [
"waf.test.example.com"
]
}
Successful Response Body
{
"id": 228622,
"domainName": "test.example.com",
"streaming": true,
"http2": true,
"http3": false,
"redirectHttpToHttps": true,
"enabled": true,
"tlsProfile": "modern",
"origins": [
{
"originUrl": "https://origin1.example.com",
"sni": "origin-sni.example.com",
"headers": {
"X-Custom-Header": "test-value",
"X-Forwarded-For": "client-ip"
},
"s3Credential": {
"accessKey": "AKIAEXAMPLE123456",
"accessSecret": "secret1234567890abcdefghijklmnopqrstuvwxyz",
"region": "us-east-1",
"dropQueryString": false
}
}
],
"defaultHostHeader": "originHost",
"alternateDomainNames": [
"waf.test.example.com"
],
"cName": "edge2x.testing.veloceed.com"
}