Configure Sandbox Client with the CLI
Before you begin
This step assumes you have already created a sandbox.
When creating a sandbox based on a property, the CLI automatically scans the Property Manager configuration, detects all the origin hostnames defined in the file, and sets the parameter to ‘yes’. The CLI updates your configuration file.
my_laptop:~ username$ akamai sandbox create --property www.example.com:5 --name sandbox_for_example.com --requesthostnames localhost,www.example.com
building origin list
Detected the following origins: origin-www.example.com
registering sandbox in local datastore
sandbox_id: 4b3a0c0e-dfe9-4df8-b175-1ed23e293c52 sandbox_for_example.com is now active
Successfully created sandbox_id 4b3a0c0e-dfe9-4df8-b175-1ed23e293c52. Generated sandbox client configuration at /Users/username/.akamai-cli/cache/sandbox-cli/sandboxes/sandbox_for_example.com/config.json Edit this file to specify the port and host for your dev environment.
my_laptop:~ username$
If you want to route sandbox traffic to different development origins, follow these steps.
How to
-
Enter
n
to override the settings. -
Enter
open config.json
to open the sandbox client configuration. You can locate the file in the cache folder for the Akamai CLI. In the example above it is/Users/username/.akamai-cli/cache/sandbox-cli/sandboxes/sandbox_for_example.com/config.json
There are three customizable sections in the Sandbox Client configuration file.
-
sandboxServerInfo
: Identify the port and IP address the Sandbox Client should run on.json { "sandboxServerInfo": { "secure": false, "port": 9550, "host": "127.0.0.1" },
-
advanced.requestDetail
: Set this value totrue
if you want to capture request and response headers and the sandbox connection logs. Find the log files in the same folder as your Sandbox Client config file."advanced": { "requestDetail": false },
-
originMappings
: Modify this section to override the origins defined in your property configuration to your development origin."originMappings": [ { "from": "origin-www.akamaidevops.com", "to": "pass-through" }
-
Modify the
target hostname
in the"originMappings"
section to point to your development origin."originMappings": [ { "from": "origin-www.akamaidevops.com", "to": { "secure": false, "port": 80, "host": "<target hostname>"
-
Add a host header line if you want to instruct the sandbox client to override the host header value that the sandbox forwards to the development origin.
"to": { "secure": false, "port": 80, "host": "www.example.com.akadns.net", "hostHeader": "dev.example.com" }
-
Configure one origin to go directly and route another origin to a dev origin as shown.
"to": { "secure": false, "port": 80, "host": "www.example.com.akadns.net", "hostHeader": "dev.example.com" } "from": "origin-static.akamaidevops.com", "to": "pass-through" }
If you have origin values that are generated at run time using Property Manager variables, you can configure your sandbox to support wildcards.
-
Allow all origin values to pass through.
"originMappings":[ { "from":*.*, "to":"pass-through" }
-
Allow a specific subdomain wildcard origin value to pass through.
"originMappings":[ { "from":"*.example.com", "to":"pass-through" }
-
Allow a specific subdomain wildcard to go to another origin.
"originMappings":[ { "from":"*.example.com", "to":[ "host":"127.0.0.1", "port":9001, "secure":false, "hostHeader":"origin-dev.example.com" ] }
Updated over 2 years ago