Redirect from Origin
Background
If an origin server uses a 301/302 redirect, when a CDN PoP sends a request to pull content requested by a user from the origin server, a 301/302 status code is returned. CDN then takes action based on whether redirect from origin is enabled.
- Disabled
The CDN PoP returns the redirect address to the user and leaves the user to finish the request process. If the domain name of the redirect address is not added to CDN, the subsequent request process will not be accelerated by CDN.
- Enabled
The CDN PoP pulls content from the redirect address and caches the content, which is then returned to the user. When another user requests the same content, the cache is returned directly.
Precautions
Procedure
- Log in to Huawei Cloud console. Choose .
The CDN console is displayed.
- In the navigation pane, choose .
- In the domain list, click the target domain name or click Configure in the Operation column.
- Click the Origin Settings tab.
- In the Redirect from Origin area, switch on or off Redirect from Origin.
Figure 1 Configuring redirect from origin
Examples
- Assume that redirect from origin is enabled for domain name www.example.com.
If a user requests the www.example.com/cdn.jpg file and the CDN PoP does not cache the content, the PoP pulls the content from the origin server. The origin server returns the HTTP status code 301 or 302 and the redirect address www.example.com/test/cdn.jpg.
- The PoP directly sends a request to the redirect address.
- After obtaining the requested content, the PoP returns the content to the user and caches the content.
- When another user requests the same file, the PoP directly returns the cached content.
- Assume that redirect from origin is disabled for domain name www.example.com.
If a user requests the www.example.com/cdn.jpg file and the CDN PoP does not cache the content, the PoP pulls the content from the origin server. The origin server returns the HTTP status code 301 or 302 and the redirect address www.example.com/test/cdn.jpg.
- The PoP directly returns the HTTP status code 301 or 302 to the user client. The user client sends a request to the redirect address.
- If the domain name of the redirect address is not added to CDN, CDN PoPs do not cache the requested content and the subsequent request process will not be accelerated.
- If another user requests the same file, the preceding process is repeated.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.