Overview
You can use this document to learn how to update a StackPath origin for an existing site.
Stackpath uses an origin to retrieve and deliver your content to your end users.
When an end user requests content that is not present in the CDN, StackPath will need to know where your content is located and how to retrieve the content for delivery.
To configure a cloud storage bucket for your origin, see:
Learn about origin settings
Review the following settings used to configure an origin:
Setting | Description |
Address |
This setting relates to the protocol, domain, and path that StackPath will use to retrieve content from your origin server. Typically, you can enter the IP address of your server to ensure that StackPath has a direct connection. |
Backup |
This setting relates to origin server failure. If an origin server experiences a failure, then a backup origin can be used. To use a backup origin, enter another address to be used in the event that the default address returns a 400 or 500 class error. To learn more, see How-To Use a Backup CDN Origin. |
Host Header |
This setting relates to the request header that StackPath sends to your origin server to pull content. This setting needs to be set to the URL version that your website responds to. If this setting is misconfigured, then StackPath may have trouble locating your content. By default, this setting is set to dynamic; however, if your server is expecting a specific custom header, then you can add that value to the Delivery Domains section, and then select it from the drop-down for Host Header. To learn more, see What is a Delivery Domain?.
|
Origin Authentication |
This setting gives the CDN credentials to use for origin pulls, if your origin uses basic http authentication. |
Pull Protocol |
This setting relates to the protocol that StackPath uses to contact the origin.
This setting allows StackPath to appropriately pull content from the desired origin.
There are 3 options:
|
SSL Validation |
When this setting is enabled, the CDN will not connect to the origin unless the origin has a valid SSL certificate for the requested domain. |
WebSockets | This setting enables websocket support through the CDN. |
Update origin via the portal
- In the StackPath Control, in the left-side navigation, click Sites.
- Locate and select the desired site.
- In the left-side navigation, click Settings.
- In the field next to Address, enter a direct IP address or a domain name:
- If you enter a direct IP address, then StackPath will pull directly from your server.
- If you ever migrate to a separate hosting provider, then you will need to update this field.
- If you enter a domain name, then StackPath will resolve your server IP through the DNS for any origin pull.
- If you ever migrate to a separate hosting provider, then you do not need to update this field.
- If your domain points to the StackPath Anycast IP or Edge Address for your website, then you may generate some errors when you enter a domain name.
- If you enter a direct IP address, then StackPath will pull directly from your server.
- Click Save.
Update origin via the API
- In the StackPath Control, in the top, right corner, click your username.
- Click My Stacks.
- Locate and select the desired stack.
- Copy your stack ID, which is displayed in the URL.
https://control.stackpath.com/stacks/<this-is-your-stack-id>
-
Retrieve a list of origin IDs that will be needed to update with the origin IP. All origin IDs will be listed for the account, so you must parse through the list to locate the desired origin to update.
curl -H "Authorization: Bearer <token>" -H "Content-type: application/json" "https://gateway.stackpath.com/cdn/v1/stacks/<origin_id>/origins"
- Run the following command to push your changes to the zone configurations. StackPath will immediately redirect Origin pulls to the new IP address or hostname.
- For path, if you are unsure of a path to set, then enter your website's root ( / ).
- For hostname, do not enter a protocol (HTTP or HTTPS).
- (Optional) For port, enter your HTTP port. You can enter 80 or a custom port.
- (Optional) For securePort, enter your HTTPS port. You an enter 443 or a custom port.
curl -H "Content-Type: application/json" -H 'authorization: Bearer <token>' -X PATCH https://gateway.stackpath.com/cdn/v1/stacks/<stack_id>/origins/<origin_id> -d '{"path": "string", "hostname": "string", "port": int, "securePort": int}'