A 400 error code returned when accessing CDN usually indicates an issue with the request. This topic describes common issues and their solutions.
Request syntax error
Common issues:
CDN does not support PATCH requests. Sending a PATCH request to CDN returns a 400 error code.
The URL is formatted incorrectly. For example, required parameters may be missing or the path may be misspelled.
The request header is incomplete or incorrectly formatted.
Solutions:
Use ESA: If you must use PATCH requests, you can use Edge Security Acceleration (ESA). ESA supports both resource acceleration and PATCH requests.
Check the URL: Make sure the URL is correctly formatted, including the protocol (http/https), domain name, path, and query parameters.
Validate the request header: Make sure all required request headers are included and correctly formatted, such as
Content-TypeandAuthorization.
Invalid parameters
Common issues:
A query parameter has an invalid value, such as an incorrect date format or a non-existent ID.
A parameter value is outside the allowed range.
Solutions:
Validate parameter values: Make sure all parameter values meet the requirements in the API documentation. For example, dates must be in ISO 8601 format, and numbers must be within the specified range.
Use default values: If some parameters are optional, you can use appropriate default values.
Missing required parameters
Common issues:
A required query parameter or request body field is missing.
Solutions:
Check the API documentation: Refer to the API documentation to make sure all required parameters are provided.
Use debugging tools: You can use tools such as Postman or cURL to manually test the request and make sure all parameters are set correctly.
Size limits
Common issues:
The request body is too large and exceeds the limits of CDN or the origin server.
A single uploaded file is too large.
Solutions:
Reduce the request body: You can optimize the request data to remove unnecessary information.
Use chunked uploads: For large files, you can use the chunked upload method.