An origin fetch occurs when a client requests a resource that is not cached on a CDN point of presence (POP), or when a prefetch task is deployed. The CDN POP then retrieves the resource from the origin server. You can configure origin fetch settings as needed.
How it works
When a user visits a website, a client, such as a browser, sends a request to a CDN POP. The request URL points to the CDN accelerated domain name.
The CDN POP checks its cache for the requested resource. If the resource is cached, the POP returns it directly to the client.
If the resource is not cached, the CDN POP sends an origin request to the origin server based on the configured origin policies.
After the origin server receives the request, it returns the resource based on the URL and parameters.
After the CDN POP retrieves the resource, it caches the resource for subsequent requests.
The CDN POP returns the resource to the client. This completes the request.
Features overview
Feature category | Feature | Description | Related links |
Origin fetch from private OSS buckets | Origin fetch from private OSS buckets | If your origin server is Alibaba Cloud Object Storage Service (OSS) and the access control list (ACL) of the bucket is set to private, you must grant CDN the required access permissions. This allows CDN POPs to fetch resources from the bucket. | |
Origin requests | Origin protocol | Specifies the protocol that CDN POPs use for origin fetch. You can set the protocol to | |
Origin HOST | The origin HOST specifies the site on the origin server that an origin request accesses. If multiple websites are hosted on the same origin server, configure the origin HOST to ensure that CDN POPs retrieve the correct resources. You can configure a global default HOST or specify different HOSTs for different origin servers. | ||
Origin URL | If the resource path on the origin server changes but the client access URL must remain the same, use the origin URL rewrite feature. When a POP fetches a resource, it rewrites the requested URL path to the new path based on the configured rules. | ||
Origin parameters | Configure rules to rewrite the request parameters in an origin URL. You can delete all parameters, keep specific parameters, or delete specific parameters. | ||
Origin request header | Customize the HTTP request headers that POPs send during origin fetch. You can add, modify, or delete header fields. This feature is often used to pass custom information to the origin server, such as user information or request source. | ||
Origin SNI and Common Name | If the origin protocol is HTTPS, configure the origin Server Name Indication (SNI) to specify the server domain name that the POP requests during the TLS handshake. This feature is useful when multiple HTTPS sites with different certificates are hosted on the same origin IP address. You can also enable the Common Name whitelist. This makes the POP verify that the | ||
Origin response | Modify origin response headers | Configure rules to add, modify, or delete HTTP response headers received from the origin server before the POP sends the resource to the client. For example, add cross-domain response headers such as | |
301/302 redirect | If the origin server returns a 301 or 302 status code, configure POPs to request resources from the redirected address on behalf of the client. This reduces the number of client requests. | ||
Other features | Timeout period | Set the maximum wait time for a POP to establish a connection with the origin server and receive data. If the origin server does not respond or the data transfer is not complete within this period, the POP disconnects and returns a 5xx error to the client. A reasonable timeout period helps fail fast and prevents long client wait times. | |
Advanced origin | If you have multiple origin servers and need to route different requests to different origins, use the advanced origin feature. Advanced origin can route requests to a specified origin server based on conditions such as request parameters or client IP addresses. | ||
Origin fetch over IPv6 | If your origin server supports IPv6, enable origin fetch over IPv6. After you enable this feature, POPs will prioritize using the IPv6 protocol to access the origin server. You can configure automatic fallback to IPv4 if IPv6 origin fetch fails to ensure service availability. |