When Railgun is active on a website, it is important to reference the
Cf-Railgun response header when confirming Railgun is working properly and/or troubleshooting Railgun for your site.
Here is the formatting for the
connection-id compression-ratio origin-time flags version
Using the example above for testing Railgun, here is what the header looks like when showing compression:
Cf-Railgun: 4fd1682b12 0.06 0.050570 0031 5360
The first variable is the connection-id (labeled
4fd1682b12), which is the unique ID of the connection between Cloudflare's rg-sender and the customer's rg-listener. Multiple requests share the same ID as it identifies the TLS connection over which the Railgun request was sent.
The second variable is the
compression-ratio, which indicates that the content for the request was compressed.
In this example the resource request was compressed to 0.06% of its original size (99.94% compression achieved for the request).
If there is an error of some sort, the Compression Ratio is likely to be listed as "normal" or "direct." This means that Railgun's compression was bypassed for one reason or another.
The presence of the word
stream in place of the compression ratio indicates that compression did not happen but that the request proceeded normally.
The third variable is the
origin-time. This measure represents time in seconds of how long Railgun waits for the origin web server to generate the page. In this example, the origin server took 0.050570 seconds from when the Railgun listener sends the request to the origin to when it responds. If this number is large, then this implies that the web server or database may be hitting a bottleneck that is slowing down its time to render the page.
The fourth variable in the header are
flags that are a word length bitfield that indicates aspects of the Railgun request/response handling. This value can be used to troubleshoot why a request's
Cf-Railgun status was
Typically it is recommend to interpret these flags using the
rg-diag utility, which is included with the Railgun packages.
The final variable
version is the first four characters of the hash value of the version of the rg-listener in use.
Railgun's diagnostic tool, rg-diag
When using the
rg-diag tool from the command line, be sure to include the
-decode switch to interpret the flag in a request. Here is an example using the header above:
rg-diag -decode 0031
Without using the
rg-diag tool, you can look at the flag field as a 4-digit sequence as zzXz. Ignore the z's and focus on the number or letter in the X position. If it is 3,7, B or F then it means Railgun Compression is working correctly.