Skip to content

Commit 29ce940

Browse files
authored
[Closes #666] [Closes #643] Creating page on cloudflare cdn-cgi endpoints (#667)
1 parent b521294 commit 29ce940

2 files changed

Lines changed: 228 additions & 2 deletions

File tree

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
---
2+
tite: Cloudflare cdn-cgi endpoints
3+
---
4+
5+
## What
6+
7+
When a domain is proxied through Cloudflare you get a new endpoint on your site
8+
9+
!!! note "Only work when proxied"
10+
11+
These will only work when your domain is proxied through cloudflare
12+
13+
This means your DNS record needs to have the <img alt="true" height="50" src="/assets/cloudflare_status.png" width="50"/> icon next to it
14+
15+
```shell
16+
/cdn-cgi/
17+
```
18+
19+
This is a special endpoint that is managed by Cloudflare, and you've got no control over it.
20+
21+
It has some interesting functionality however, that's not centrally documented anywhere - so this is my attempt to do so
22+
and centrally document them as I've come across them
23+
24+
## Access
25+
26+
These endpoints are for Cloudflare's _Access_ product. Zerotrust auth platform etc
27+
28+
### `/cdn-cgi/access/logout`
29+
30+
This allows you to log out of the sessions when using Cloudflare Access
31+
32+
!!! note "This is across all applications"
33+
34+
Using this will log you out across all your Access applications
35+
36+
#### How to use
37+
38+
* `<application-domain>/cdn-cgi/access/logout`
39+
* `<team-name>.cloudflareaccess.com/cdn-cgi/access/logout`
40+
41+
### `cdn-cgi/access/certs`
42+
43+
Ability to access Signing keys used to mint JWT's
44+
45+
Example from Cloudflare's Documentation
46+
47+
```json
48+
{
49+
"keys": [
50+
{
51+
"kid": "1a1c3986a44ce6390be42ec772b031df8f433fdc71716db821dc0c39af3bce49",
52+
"kty": "RSA",
53+
"alg": "RS256",
54+
"use": "sig",
55+
"e": "AQAB",
56+
"n": "5PKw-...-AG7MyQ"
57+
},
58+
{
59+
"kid": "6c3bffef71bb0a90c9cbef3b7c0d4a1c7b4b8b76b80292a623afd9dac45d1c65",
60+
"kty": "RSA",
61+
"alg": "RS256",
62+
"use": "sig",
63+
"e": "AQAB",
64+
"n": "pwVn...AA6Hw"
65+
}
66+
],
67+
"public_cert": {
68+
"kid": "6c3bffef71bb0a90c9cbef3b7c0d4a1c7b4b8b76b80292a623afd9dac45d1c65",
69+
"cert": "-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE----- "
70+
},
71+
"public_certs": [
72+
{
73+
"kid": "1a1c3986a44ce6390be42ec772b031df8f433fdc71716db821dc0c39af3bce49",
74+
"cert": "-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE----- "
75+
},
76+
{
77+
"kid": "6c3bffef71bb0a90c9cbef3b7c0d4a1c7b4b8b76b80292a623afd9dac45d1c65",
78+
"cert": "-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE----- "
79+
}
80+
]
81+
}
82+
```
83+
84+
#### How to use
85+
86+
* `https://<team-name>.cloudflareaccess.com/cdn-cgi/access/certs`
87+
* `<application-domain>/cdn-cgi/access/certs`
88+
89+
### `/cdn-cgi/access/get-identity`
90+
91+
This endpoint allows you to view information about your user identity and diagnose groups issues
92+
93+
Example response
94+
95+
```json
96+
{
97+
"id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
98+
"email": "user@example.com",
99+
"idp": {
100+
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d4e5",
101+
"type": "oidc"
102+
},
103+
"geo": {
104+
"country": "GB"
105+
},
106+
"user_uuid": "98765432-aaaa-bbbb-cccc-1234567890ab",
107+
"account_id": "11223344556677889900aabbccddeeff",
108+
"iat": 1762449672,
109+
"devicePosture": {
110+
"c0ffee00-dead-beef-1234-567890abcdef": {
111+
"type": "gateway",
112+
"rule_name": "Gateway",
113+
"success": false
114+
}
115+
},
116+
"ip": "203.0.113.10",
117+
"auth_status": "NONE",
118+
"common_name": "",
119+
"service_token_status": false,
120+
"is_warp": false,
121+
"is_gateway": false,
122+
"version": 0,
123+
"device_sessions": {
124+
"11111111-2222-3333-4444-555555555555": {
125+
"last_authenticated": 1728658943,
126+
"warp_as_idp": {
127+
"iat": 1728658943,
128+
"expires": 1728687743
129+
}
130+
},
131+
"22222222-3333-4444-5555-666666666666": {
132+
"last_authenticated": 1745517768,
133+
"warp_as_idp": {
134+
"iat": 1745517768,
135+
"expires": 1745546568
136+
}
137+
},
138+
"33333333-4444-5555-6666-777777777777": {
139+
"last_authenticated": 1745518329,
140+
"warp_as_idp": {
141+
"iat": 1745518329,
142+
"expires": 1745547129
143+
}
144+
},
145+
"44444444-5555-6666-7777-888888888888": {
146+
"last_authenticated": 1745518984,
147+
"warp_as_idp": {
148+
"iat": 1745518984,
149+
"expires": 1745547784
150+
}
151+
},
152+
"55555555-6666-7777-8888-999999999999": {
153+
"last_authenticated": 1749857168,
154+
"warp_as_idp": {
155+
"iat": 1749857168,
156+
"expires": 1749885968
157+
}
158+
},
159+
"66666666-7777-8888-9999-aaaaaaaaaaaa": {
160+
"last_authenticated": 1745587461,
161+
"warp_as_idp": {
162+
"iat": 1745587461,
163+
"expires": 1745616261
164+
}
165+
},
166+
"77777777-8888-9999-aaaa-bbbbbbbbbbbb": {
167+
"last_authenticated": 1746793067,
168+
"warp_as_idp": {
169+
"iat": 1746793067,
170+
"expires": 1746821867
171+
}
172+
},
173+
"88888888-9999-aaaa-bbbb-cccccccccccc": {
174+
"last_authenticated": 1757882690,
175+
"warp_as_idp": {
176+
"iat": 1757882690,
177+
"expires": 1757911490
178+
}
179+
}
180+
},
181+
"custom": {
182+
"groups": [
183+
"mealie"
184+
]
185+
}
186+
}
187+
```
188+
189+
#### How to use
190+
191+
* `https://<team-name>.cloudflareaccess.com/cdn-cgi/access/get-identity`
192+
* `<application-domain>/cdn-cgi/access/get-identity`
193+
194+
## Generic
195+
196+
These are endpoints that do not rely on any products
197+
198+
### `/cdn-cgi/trace`
199+
200+
This endpoint gives you information about your request
201+
202+
Example would be
203+
204+
```text
205+
fl=736f69
206+
h=documentation.breadnet.co.uk
207+
ip=69.69.69.69
208+
ts=1762450907.000
209+
visit_scheme=https
210+
uag=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
211+
colo=LHR
212+
sliver=none
213+
http=http/3
214+
loc=GB
215+
tls=TLSv1.3
216+
sni=encrypted
217+
warp=off
218+
gateway=off
219+
rbi=off
220+
kex=X25519MLKEM768
221+
```
222+
223+
#### How to use
224+
225+
* `<domain-or-subdomain>/cdn-cgi/trace`

mkdocs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ nav:
55
- Fingerprint on Linux Mint: kb/authentication/fingerprint-on-linux-mint.md
66
- Cloud init:
77
- cloud-init: kb/cloud-init/cloud-init.md
8+
- Cloudflare:
9+
- "Cloudflare cdn-cgi endpoints": kb/cloudflare/cloudflare-cdn-cgi-endpoints.md
10+
- Cloudflare Zero Forwarded header: kb/cloudflare/cloudflare-zero-forwarded-header.md
811
- Cloudflared:
912
- kb/cloudflared/index.md
1013
- Cloudflared on Ubuntu for ssh: kb/cloudflared/cloudflared-on-ubuntu-for-ssh.md
@@ -56,8 +59,6 @@ nav:
5659
- View JWT Claim GitHub actions: kb/githubactions/view-jwt-claim-github-actions.md
5760
- Google Workspace:
5861
- Setup Routing: kb/google-workspace/setup-routing.md
59-
- Cloudflare:
60-
- Cloudflare Zero Forwarded header: kb/cloudflare/cloudflare-zero-forwarded-header.md
6162
- Grocy:
6263
- Set Grocy to use Cloudflare Zero trust usernames: kb/grocy/set-grocy-to-use-cloudflare-username.md
6364
- Set grocy to use pritunl Zero usernames: kb/grocy/set-grocy-to-use-pritunl-username.md

0 commit comments

Comments
 (0)