In custom error pages we have a few tokens, but on the 1xxx and 5xx class errors they only come with one “box” token that has a lot of information.
DNS resolution error
You've requested a page on a website (cloudflarepreview.com) that is on the Cloudflare network. Cloudflare is currently unable to resolve your requested domain (cloudflarepreview.com). There are two potential causes of this:
Most likely: if the owner just signed up for Cloudflare it can take a few minutes for the website's information to be distributed to our global network.
Less likely: something is wrong with this site's configuration. Usually this happens when accounts have been signed up with a partner organization (e.g., a hosting provider) and the provider's DNS fails.
Ray ID: 000000000000000
Timestamp: Thu, 01-Jan-70 00:00:00 GMT
Your IP address: 172.69.42.58
Requested URL: example.url/foo
Error reference number: 1001
Server ID: FL_FOO
User-Agent: Example User Agent
Ray ID: 000000000000000
Client IP: 172.69.42.58
Was there a way to access this sort of information more granularly? I just want the error reference number and the error text for parts of my custom page layout.
I thought I’d add, this is the markup for those tokens.
<div class="cf-error-details cf-error-1001">
<h1>DNS resolution error</h1>
<p>You've requested a page on a website (cloudflarepreview.com) that is on the <a data-orig-proto="https" data-orig-ref="www.cloudflare.com" target="_blank">Cloudflare</a> network. Cloudflare is currently unable to resolve your requested domain (cloudflarepreview.com). There are two potential causes of this:</p>
<ul>
<li><strong>Most likely:</strong> if the owner just signed up for Cloudflare it can take a few minutes for the website's information to be distributed to our global network.</li>
<li><strong>Less likely:</strong> something is wrong with this site's configuration. Usually this happens when accounts have been signed up with a partner organization (e.g., a hosting provider) and the provider's DNS fails.</li>
</ul>
<ul class="cferror_details">
<li>Ray ID: 000000000000000</li>
<li>Timestamp: Thu, 01-Jan-70 00:00:00 GMT</li>
<li>Your IP address: 172.69.42.58</li>
<li class="XXX_no_wrap_overflow_hidden">Requested URL: example.url/foo </li>
<li>Error reference number: 1001</li>
<li>Server ID: FL_FOO</li>
<li>User-Agent: Example User Agent</li>
</ul>
</div>
In its current state it is problematic, it provides an H1 so I cannot provide an H1 semantically in my custom error page. The elements aren’t given any way of selecting them, if they were wrapped with classes or inner elements it might be possible to use without the need for tokens for each thing.
There are no options here. That code needs to be on the page.
You could wrap that token in a DIV, and use CSS to hide the whole thing. The HTML will be there if you view the source, but it won’t show on the page. Then you could use a generic message instead.
Thanks Sdayman,
I think you misunderstood what I was after.
I understand the token has to be on the page. I don’t mind all of the content there, however Cloudflare’s choice to send opinionated html, like an H1 in the token instead of providing tokens for each part makes the custom error pages nearly useless.
I would like to have greater access to the information about the error to do more with it in the layout. Like providing a page header with the error code and the error message formatted differently.
I want to be able to provide a more specific message, not a general one.