Test on staging
Before you serve traffic through the Akamai production network, it's recommended that you test your configuration on the staging network.
This procedure applies to environments with the testing and production profiles. Your service hostnames reach them through a host-based route, the same way your production traffic does, so testing doesn't require any tokens or environment headers. Development environments are isolated and use a different method. See Test a development environment.
How testing on staging works
Once an environment version and its service hostname set are activated on the staging network, the same configuration your production traffic would get is available on staging edge servers.
You redirect your requests to a staging edge server while keeping your service hostname in the URL, so the Host header and the TLS SNI still carry it. The edge matches the correct service hostname and edge certificate, and the host-based route selects the environment — exactly as it does in production.
You can redirect requests two ways:
| Method | Use it when |
|---|---|
| Per request, from the command line | You're making quick checks, scripting assertions into a pipeline, or you can't change system settings. |
| Through your local hosts file | You're testing in a browser, or with a tool that has no per-request redirection of its own. |
Akamai's staging network is a subset of servers you use for testing configuration changes rather than performance. As the individual servers in the staging network can change over time, resolve the staging edge hostname again before you start a new round of testing. Don't reuse an IP address you resolved previously, and don't use the same IP address for an extended period of time.
Before you begin
Before testing on staging, make sure you meet these prerequisites:
- Your environment version and the service hostname set you want to test with are both activated on the staging network. Environments and service hostname sets activate on independent tracks, and they need to be active on the same network to interact.
- Domain ownership and certificates for the service hostnames in the set are validated. Until certificate validation completes, HTTPS requests to those service hostnames fail.
- HTTPS custom certificates only. Push the edge certificate to staging. If you're going to use a custom certificate for the client to edge server connection, you need to push it to the staging network before you test your HTTPS delivery. By default, when you create a CPS-managed certificate, it's automatically deployed to the production network. To test the certificate, you need to manually push it to the staging network. See Certificate Provisioning System for detailed instructions.
- You have a way to redirect requests to a staging edge server, either per request from the command line or through your local hosts file. Editing the hosts file needs administrator privileges on most systems.
1. Find your staging edge hostname
- From the Control Center menu, click Content delivery > CDN > Delivery Manager.
- In the Workspaces page, click the workspace that contains the set you want to edit.
- Open service hostnames:
- Workspace level: Go to the Service hostnames tab within a workspace to view all of its service hostnames and sets.
- Environment level: Go to the Environments tab within a workspace and click the environment that contains the set you want to test. Next, go to the Service hostnames tab to view only the sets routed to that environment.
- In the Service hostnames tab, find and make note of your edge hostname.
- Append
-stagingbefore the final.net. For example,www.example.com.edgekey.netbecomeswww.example.com.edgekey-staging.net.
This is the staging network target for your service hostname.
2. Point your requests to staging
Choose one of these methods to reach the staging network. Both keep your service hostname in the URL, which is what lets the edge match the right service hostname and certificate.
Per request
Point the connection at your staging edge hostname without resolving it yourself and without changing anything on your system:
curl -v https://www.example.com/ --connect-to ::www.example.com.edgekey-staging.net:
--connect-to opens the connection to the staging edge hostname while leaving the URL untouched. This needs curl 7.49 or later.
Per-request redirection resolves the staging edge hostname fresh on every request, so you never hold a stale IP address. It also works in use cases where modifying a hosts file isn't possible.
If your tool accepts an explicit hostname-to-IP mapping instead, resolve the IP address first:
-
Windows: Open a new command prompt and perform an
nslookupof the staging edge hostname:nslookup www.example.com.edgekey-staging.net -
macOS, Linux, or Unix: Open a new terminal and perform a
digof the staging edge hostname:dig +short www.example.com.edgekey-staging.net
Copy an IP address from the response and supply it to your tool. Resolve it again at the start of each testing round.
Through your hosts file
Use this for browsers and for tools with no per-request redirection of their own.
-
Resolve the IP address of your staging edge hostname, using the
nslookupordigcommand above, and copy it from the response. -
Open your local hosts file in a text editor. See your operating system's user documentation for the default location. Typically, you can find it in these directories:
- Windows:
C:\Windows\System32\drivers\etc\hosts. The directory above\system32\might vary in your environment. - macOS:
/private/etc/hosts. - Linux or Unix:
/etc/hosts.
- Windows:
-
At the end of the hosts file, add an entry that pairs the IP address you copied with your service hostname. For example:
12.34.56.78 www.example.comAdd one line per service hostname you want to test.
-
Save and close the hosts file.
-
Flush your local DNS cache:
-
Windows: Open a new command prompt and run this command:
ipconfig /flushdns -
macOS: Open a new terminal and run this command:
sudo killall -HUP mDNSResponder
-
All requests from your local system to that service hostname now go to the staging edge server. The change applies only to your local system and doesn't affect anyone else.
3. Confirm you reached the staging network
Verify connectivity with a command-line tool before you test anything else.
-
If you're using the recommended Enhanced Debug behavior, generate an auth token and pass it in the
Akamai-Debugheader:curl -vvvv "https://www.example.com/" -H "Akamai-Debug: exp=1762...700b cache" -
If you're using Pragma debugging, specify the
Pragmaheader:curl -vvvv "https://www.example.com/" -H "Pragma: akamai-x-cache-on, akamai-x-cache-remote-on"
A successful response looks like this:
HTTP/1.1 200 OK
...
X-Akamai-Staging: ESSL
X-Cache: TCP_MISS from ...
Making a request to Akamai staging edge servers adds the X-Akamai-Staging response header. The value is X-Akamai-Staging: ESSL for requests using an Enhanced TLS edge hostname, or X-Akamai-Staging: EdgeSuite for requests using a Standard TLS edge hostname.
Then check for the X-Cache response header and interpret the result:
| Did the page load as expected? | Is the X-Cache header present? | Result |
|---|---|---|
| Yes | Yes | Success. You're ready to test. |
| No | Yes | You reached an edge server, but something isn't working. The value of the X-Cache entry might help you identify the problem. |
| Yes | No | You reached the origin, not the edge server. Check how you redirected your requests. |
| No | No | You haven't reached either the edge or your origin. Check how you redirected your requests. |
4. Test your configuration
Test your site just as you would if you were testing against your origin. Edge testing doesn't depend on how you deployed the configuration, so you can use whatever tools and test suites you already have.
When testing, use your actual service hostname for requests. Don't use its edge hostname or its staging edge hostname. Both bypass the hostname matching that this method depends on.
-
Check your site's key functionality, such as logging in, using the shopping cart, playback, and any flow that spans more than one request.
-
Verify the behavior your version actually changes. Depending on the configuration, that can include:
- Response status codes and response headers.
- Caching behavior, including
Cache-Controland whether objects are cached at all. - Redirect logic, including the destination and status code of each redirect.
- Origin routing, if paths in this version resolve to different origins.
-
Test each service hostname in the set, if the version behaves differently per hostname.
5. Integrate checks into your pipeline
Edge behavior is verifiable with ordinary HTTP assertions, so you can run these checks from the same framework and pipeline you already use for your application, ahead of a production activation.
- Express each check as an assertion on the response, such as a status code, a specific header, a cache result, or a redirect target, rather than on whether the request succeeded.
- Point the assertions at your service hostname, with requests redirected to staging by whichever method in step 2 suits your runner.
- Run the suite as a gate before activating on the production network, and fail the build when an assertion fails.
- Re-resolve the staging edge hostname at the start of each run rather than storing an IP address in your configuration.
6. Clean up
- If you added a hosts file entry, remove it, save the file, and flush your local DNS cache again. Nothing to undo if you redirected per request.
- If the testing was successful, activate the configuration on the Akamai production network, along with the associated custom edge certificate if you use one.
Troubleshooting
| Symptom | Likely cause |
|---|---|
The page loads but no X-Akamai-Staging header appears | You reached your origin rather than the edge. Check how you redirected your requests. Check the hosts file entry, confirm you flushed your DNS cache, and re-resolve the test IP addresses in case they're stale. |
| No response at all | The environment version or the service hostname set isn't activated on the staging network, or they're activated on different networks. |
| TLS error, or a certificate for the wrong hostname | Domains and certificates aren't validated yet, a custom edge certificate hasn't been pushed to staging, or the staging edge hostname is in the request URL instead of your service hostname. |
| 404 or unexpected content | The hostname in your URL isn't in a service hostname set routed to this environment. |
| The response reflects an older configuration | A newer environment version was never activated on staging. Activation on staging and production are separate. |
| Testing worked earlier and now fails | The staging IP address rotated. Resolve the staging edge hostname again, or switch to per-request redirection. |
Updated about 1 month ago
