| 1 | /** |
| 2 | * Header carrying a JSON-serialised `request.cf` object into the runtime. |
| 3 | * When present on an incoming request, the entry middleware uses it verbatim |
| 4 | * as the user worker's `request.cf`; it is also set by workerd on loopback |
| 5 | * requests (via `cfBlobHeader`) so `request.cf` round-trips to Node-side |
| 6 | * handlers. Named for compatibility with Miniflare's `MF-CF-Blob` header, |
| 7 | * which tooling (e.g. Wrangler's `getPlatformProxy`) already uses. |
| 8 | */ |
| 9 | export const HEADER_CF_BLOB = "MF-CF-Blob"; |
| 10 | |
| 11 | /** |
| 12 | * Default `request.cf` object, matching Miniflare's fallback blob |
| 13 | * (`workers-sdk/packages/miniflare/src/cf.ts`). |
| 14 | */ |
| 15 | export const fallbackCf: Record<string, unknown> = { |
| 16 | asOrganization: "", |
| 17 | asn: 395747, |
| 18 | colo: "DFW", |
| 19 | city: "Austin", |
| 20 | region: "Texas", |
| 21 | regionCode: "TX", |
| 22 | metroCode: "635", |
| 23 | postalCode: "78701", |
| 24 | country: "US", |
| 25 | continent: "NA", |
| 26 | timezone: "America/Chicago", |
| 27 | latitude: "30.27130", |
| 28 | longitude: "-97.74260", |
| 29 | clientTcpRtt: 0, |
| 30 | httpProtocol: "HTTP/1.1", |
| 31 | requestPriority: "weight=192;exclusive=0", |
| 32 | tlsCipher: "AEAD-AES128-GCM-SHA256", |
| 33 | tlsVersion: "TLSv1.3", |
| 34 | tlsClientAuth: { |
| 35 | certPresented: "0", |
| 36 | certVerified: "NONE", |
| 37 | certRevoked: "0", |
| 38 | certIssuerDN: "", |
| 39 | certSubjectDN: "", |
| 40 | certIssuerDNRFC2253: "", |
| 41 | certSubjectDNRFC2253: "", |
| 42 | certIssuerDNLegacy: "", |
| 43 | certSubjectDNLegacy: "", |
| 44 | certSerial: "", |
| 45 | certIssuerSerial: "", |
| 46 | certSKI: "", |
| 47 | certIssuerSKI: "", |
| 48 | certFingerprintSHA1: "", |
| 49 | certFingerprintSHA256: "", |
| 50 | certNotBefore: "", |
| 51 | certNotAfter: "", |
| 52 | certRFC9440: "", |
| 53 | certRFC9440TooLarge: false, |
| 54 | certChainRFC9440: "", |
| 55 | certChainRFC9440TooLarge: false, |
| 56 | }, |
| 57 | edgeRequestKeepAliveStatus: 0, |
| 58 | hostMetadata: undefined, |
| 59 | clientTrustScore: 99, |
| 60 | botManagement: { |
| 61 | corporateProxy: false, |
| 62 | verifiedBot: false, |
| 63 | ja3Hash: "25b4882c2bcb50cd6b469ff28c596742", |
| 64 | staticResource: false, |
| 65 | detectionIds: [], |
| 66 | score: 99, |
| 67 | }, |
| 68 | }; |