From 2238f814be08cf221d18bb235f2db898e7f249ef Mon Sep 17 00:00:00 2001 From: Anthony Donlon <4056887+donlon@users.noreply.github.com> Date: Wed, 10 Dec 2025 10:27:50 +0800 Subject: [PATCH] readme: add FAQ --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 986860c..1b0f4d7 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,16 @@ params = { [Demo](https://virt.moe/cloudflare-error-page/examples/working) +## FAQ + +### How to show real user IP / Cloudflare Ray ID / data center location in the error page so that it looks more realistic? + +Ray ID and user IP field in the error page can be set by `ray_id` and `client_ip` properties in the `params` argument passed to the render function. The real Cloudflare Ray ID and the data center location of current request can be extracted from the `Cf-Ray` request header (e.g. `Cf-Ray: 230b030023ae2822-SJC`). Detailed description of this header can be found in [Cloudflare documentation](https://developers.cloudflare.com/fundamentals/reference/http-headers/#cf-ray (https://developers.cloudflare.com/fundamentals/reference/http-headers/#cf-ray)). + +To lookup the city name of the data center corresponding to the three letter code in the header, you can use a location list from [here](https://github.com/Netrvin/cloudflare-colo-list/blob/main/DC-Colos.json) + +The demo server runs in our website did handle these. Take a look at [this file](https://github.com/donlon/cloudflare-error-page/blob/94c3c4ddbe521dee0c9a880ef33fa7a9f0720cbe/editor/server/utils.py#L34) for reference. + ## See also - [cloudflare-error-page-3th.pages.dev](https://cloudflare-error-page-3th.pages.dev/):