This script is useful if there is a proxy or a CDN between the client and the Pantheon Global CDN. This script will allow you to bypass the external CDN/proxy and resolve the request directly to Pantheon GCDN.
Client browser -> Cloudflare/ Proxy -> GCDN -> Pantheon Origin
Client browser -> GCDN -> Pantheon Origin
#!/bin/bash
############################################################
# Help #
############################################################
Help()
{
# Display Help
echo "Add description of the script functions here."
echo
echo "Syntax: dbgr [-p|h|i|d|o|e]"
echo "options:"
echo "p Port number."
echo "h Print this Help."
echo "i Internet protocol address or IP."
echo "d Public facing domain name."
echo "o Origin domain where the public facing domain will get resolved to."
echo "e Expose the hidden Pantheon and Fastly headers ."
echo
}
############################################################
# Main program #
############################################################
# Set variables
Port=8080
IP="127.0.0.1"
Domain="pantheon.io"
Origin="pantheon.io"
Expose=false
############################################################
# Process the input options. Add options as needed. #
############################################################
# Get the options
while getopts ":hp:i:d:o:e" option; do
case $option in
h) # display Help
Help
exit;;
p) # Get the port
Port=$OPTARG;;
i) # Resolve to IP
IP=$OPTARG;;
d) # Domain name
Domain=$OPTARG;;
o) # Origin domain
Origin=$OPTARG;;
e) # Expose hidden headers
Expose=true;;
\?) # Invalid option
echo "Error: Invalid option"
exit;;
esac
done
if [ "$Expose" = true ]
then
curl -H "Pantheon-Debug:1" -H "Fastly-Debug:1" -LIsvo /dev/null --resolve $Origin:$Port:$IP $Domain
else
curl -LIsvo /dev/null --resolve $Origin:$Port:$IP $Domain
fi
To use
SCRIPT-NAME -p 443 -i 23.185.0.2 -o live-pantheon.pantheonsite.io -d https://pantheon.io
To include hidden headers
SCRIPT-NAME -p 443 -i 23.185.0.2 -o live-pantheon.pantheonsite.io -d https://pantheon.io -e
Sample output