An Origin is where StackPath services retrieve all content for delivery. When content is requested by end-users, but not present in the CDN's Cache (aka a cache-miss), StackPath will need to know where your content is located, and how to fetch it.
If you would like to configure a cloud storage bucket for your origin, please review these articles tailored to specific bucket providers:
Google Cloud Storage
Amazon S3
Control Panel Settings
A Site's Origin can be configured by selecting Sites >> The Domain you'd like to configure >> the Settings tab
Origin Address
The Origin Address can be input in one of two ways:
- Direct IP: Change the IP in the Origin Address box on StackPath Control Panel. This lets StackPath pull directly from your server. In this case, you will need to update the settings if you ever migrate to a separate hosting provider.
- Domain: This makes StackPath resolve your server IP through DNS for any Origin Pull. In this case, you will not need to update the settings when migrating to a separate hosting provider. (If you have pointed your domain to the StackPath Anycast IP, or Edge Address for your website, using a domain in the Origin Address Field may generate errors)
Origin Backup
StackPath allows for the use of a backup origin by enabling this setting. You can input another address to be used in the event the default address returns a 400 or 500 class error. Feel free to read this article about Backup origins, if you'd like to know more information.
Origin Host Header
This is used as the "Host" Request Header StackPath sends to your origin upon content pull. This setting will need to be set to the version of your URL your website will respond to. If this is misconfigured in any way, StackPath may have trouble finding your content.
The default list is taken from Delivery Domains you have configured, but a custom header is always configurable.
Origin Pull Protocol
The Origin Pull Protocol is the protocol StackPath will use when contacting the Origin. This setting has three options:
- HTTP or HTTPS: StackPath will make a request to the Origin with the protocol that was specified by the end-user. This is ideal if there is an HTTP to HTTPS redirect enabled on the origin and you would like StackPath's services to follow that.
- HTTP Only: StackPath will make requests to the origin over the non-secure HTTP port 80. This is useful if there is no SSL certificate configured on the Origin, and can be used to securely deliver content to end-users.
- HTTPS Only: StackPath will make requests to the origin only over the secure HTTPS port 443. This is useful for origins with SSL configured, but no redirect is in place. This is also the recommended setting for using StackPath's "Force HTTPS" EdgeRule.
Configuring these settings will allow StackPath to appropriately pull content from the desired origin.
Using the StackPath API
The following will guide you step-by-step on how to change a single origin through the API. If you have not used the StackPath API yet, read this introduction here to get started.
Step 1: Get your Stack ID
After logging into the control panel and viewing a Stack, the ID is at the end of the URL, which looks like this.
https://control.stackpath.com/stacks/<this-is-your-stack-id>
Step 2: Retrieve a list of Origins
After documenting the 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 be sure to parse through them to determine which Origin is desired.
curl -H "Authorization: Bearer <token>" -H "Content-type: application/json" "https://gateway.stackpath.com/cdn/v1/stacks/<origin_id>/origins"
Step 3: Update Origin Hostname
This final step will push changes to the Zone configurations. Once submitted, StackPath will immediately redirect Origin pulls to the new IP address or hostname.
- If you're not sure what you should set for Path, set it to your website root '/'.
- The hostname should not include the protocol (HTTP, HTTPS)
- Port is your HTTP port, not required. Set to 80 or custom port
- SecurePort is your HTTPS port and is not required. Set to 443 or 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}'