Configure a proxy to control how the Contentstack CLI routes network requests. Use this setup when working behind corporate firewalls or restricted networks.
This guide provides step-by-step instructions on how to configure and manage proxy settings in the Contentstack Command Line Interface (CLI).
Note: The CLI supports proxy configuration through both global config and environment variables. Environment variables (HTTPS_PROXY or HTTP_PROXY) take priority over global config settings.
| Task | Command |
|---|---|
| Set proxy | csdx config:set:proxy --host <host> --port <port> |
| Get proxy | csdx config:get:proxy |
| Remove proxy | csdx config:remove:proxy |
Having these details upfront helps you choose the correct configuration method and avoid connectivity issues later.
The config:set:proxy command lets you set proxy configuration for the CLI in the global config.
csdx config:set:proxy --host <host> --port <port> --protocol <protocol>With these steps, you have successfully set proxy configuration in the CLI. After you set the proxy, the CLI routes requests through the proxy stored in global configuration.
Usage
csdx config:set:proxyOptions
Examples
csdx config:set:proxy --host 127.0.0.1 --port 3128When you omit the --username flag, the proxy is configured without authentication.
csdx config:set:proxy --host proxy.example.com --port 8080 --protocol httpscsdx config:set:proxy --host proxy.example.com --port 8080 --username userWhen you include the --username flag, the CLI prompts you to enter the password securely.
The config:get:proxy command fetches the proxy configuration that you have set in the global config.
csdx config:get:proxyYou can now view the proxy configuration currently stored in the CLI global config.
Usage
csdx config:get:proxyOutput
The config:remove:proxy command lets you remove an existing proxy configuration from the global config.
csdx config:remove:proxyThe proxy configuration has been removed from the CLI global config, and the CLI no longer uses it unless a proxy is set via environment variables.
Usage
csdx config:remove:proxyExamples
csdx config:remove:proxyIn addition to the global config, you can also configure proxy settings using environment variables. Environment variables take priority over global config settings.
macOS/Linux: Add the following to your ~/.zshrc, ~/.bashrc or ~/.profile file:
export HTTPS_PROXY=http://proxy.example.com:8080
export HTTP_PROXY=http://proxy.example.com:8080
For authenticated proxies:
export HTTPS_PROXY=http://<username>:<password>@proxy.example.com:<port>
Windows: Set via System Properties or PowerShell:
$env:HTTPS_PROXY="http://proxy.example.com:8080"
$env:HTTP_PROXY="http://proxy.example.com:8080"
For authenticated proxies:
$env:HTTPS_PROXY="http://<username>:<password>@proxy.example.com:<port>"
The CLI determines which proxy configuration to use in the following order:
If both are configured, the CLI uses the proxy settings defined in the environment variables.