This article is also available in:
cURL is a command line tool for sending HTTP/HTTPS requests and is useful for troubleshooting:

HTTP/HTTPS Performance
HTTP Error Responses
HTTP Headers
APIs
Comparing Server/Proxy Responses
SSL Certificates

In this article, we will show you how to troubleshoot requests with cURL.

Step by Step Tutorials

cURL is not installed by default in Windows and requires an install wizard.

Run the following command to send a standard HTTP GET request to your website (replace www.example.com with your domain and host name):

curl -svo /dev/null http://www.example.com/


This example cURL command returns output detailing the HTTP response and request headers but discards the page body output. cURL output confirms the HTTP response and whether ShopBase is currently proxying traffic for the site.

Review the cURL command options for additional functionality.

Refer to the list below for tips on troubleshooting HTTP errors, performance, caching, and SSL/TLS certificates:

HTTP errors

When troubleshooting HTTP errors in responses from ShopBase, test whether your origin caused the errors by sending requests directly to your origin web server. To troubleshoot HTTP errors, run a cURL directly to your origin web server IP address (bypassing ShopBase's proxy):

curl -svo /dev/null http://example.com --connect-to ::203.0.113.34


If you have multiple origin web servers, test each one to ensure there are no response differences. If you observe the issue when connecting directly to your origin web server, contact your hosting provider for assistance.

Performance

cURL measures latency or performance degradation for HTTP/HTTPS requests via the -w or --write-out cURL options. The example cURL below measures several performance vectors in the request transaction such as duration of the TLS handshake, DNS lookup, redirects, transfers, etc:

curl -svo /dev/null https://example.com/ -w "\nContent Type: %{content_type} \
\nHTTP Code: %{http_code} \
\nHTTP Connect:%{http_connect} \
\nNumber Connects: %{num_connects} \
\nNumber Redirects: %{num_redirects} \
\nRedirect URL: %{redirect_url} \
\nSize Download: %{size_download} \
\nSize Upload: %{size_upload} \
\nSSL Verify: %{ssl_verify_result} \
\nTime Handshake: %{time_appconnect} \
\nTime Connect: %{time_connect} \
\nName Lookup Time: %{time_namelookup} \
\nTime Pretransfer: %{time_pretransfer} \
\nTime Redirect: %{time_redirect} \
\nTime Start Transfer: %{time_starttransfer} \
\nTime Total: %{time_total} \
\nEffective URL: %{url_effective}\n" 2>&1


As demonstrated in the preceding example, cleaner results are achieved by denoting a new line with \n before each variable. Otherwise, all metrics are displayed together on a single line.

Caching

cURL helps review the HTTP response headers that influence caching. In particular, review several HTTP headers when troubleshooting ShopBase caching:

CF-Cache-Status
Cache-control/Pragma
Expires
Last-Modified
S-Maxage

SSL/TLS certificates:

Reviewing Certificates with cURL: The following cURL command shows the SSL certificate served by ShopBase during an HTTPS request (replace www.example.com with your domain and host name):

curl -svo /dev/null https://www.example.com/ 2>&1 | egrep -v "^{.*$|^}.*$|^* http.*$"


2>&1 | egrep -v "^{.$|^}.$|^ http.*$" *cleans and parses the TLS handshake and certificate information.

To display the origin certificate (assuming one is installed), replace 203.0.113.34 below with the actual IP address of your origin web server and replace www.example.com with your domain and host name:

curl -svo /dev/null https://www.example.com --connect-to ::203.0.113.34 2>&1 | egrep -v "^{.*$|^}.*$|^* http.*$"


Testing TLS Versions: If troubleshooting browser support or confirming what TLS versions are supported, cURL allows you to test a specific TLS version by adding one of the following options to your cURL:

--tlsv1.0
--tlsv1.1
--tlsv1.2
--tlsv1.3

Related articles

Gather information for troubleshooting sites
Was this article helpful?
Cancel
Thank you!