The Redirection from Origin option controls whether the CDN follows redirects returned by the origin. By default, this option is disabled, which means that when the origin returns an HTTP 3xx status code, the CDN simply caches and serves this response to the user. If you enable this option, the CDN automatically retrieves the target content from the new location, which is then cached and returned to the user.
Important: Setting redirects may cause users to receive an outdated version of the content, so it is recommended that you purge the CDN cache when changes are made.
To configure origin redirection using the Gcore Customer Portal:
1. Go to CDN and select the CDN resource you want to configure.
2. In the sidebar, under the Cache section, select Redirection from origin.
3. Toggle Follow redirect from origin on.
4. Select one or more status codes in the Redirect status codes select box. The options are:
5. Click Save changes. Allow at least 15 minutes for the changes to take effect.
Note: Once saved, we recommend purging the CDN cache to ensure that users receive an updated version of your content.
To configure origin redirection using the API, the request must include the follow_origin_redirect
object. The following is a sample code for the object:
"options": {
"follow_origin_redirect": {
"enabled": true,
"codes": [
302,
308
]
}
}
The follow_origin_redirect
object passes the following information:
Property | Description |
enabled | This property indicates whether to enable Redirection from Origin. Possible values:
|
codes | This property is an array of HTTP status codes that will cause the CDN to follow a redirect. The array must contain a minimum of 1 and a maximum of 5 items. Possible values: 301, 302, 303, 307, 308 |
This example shows a CDN update request that activates the Redirection from Origin and instructs the CDN to follow redirects for status codes 301, 302, and 303.
Was this article helpful?
Learn more about our next-gen CDN