cloudflare / cloudflare/workerd
[FEATURE] Expose Workers Cloudflare Region
Open
feature request
types
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
Right now if I want to know from which cloudflare region any workers instance has been invoked from I need to use something like this
```javascript
export default {
async fetch(request) => {
const res = await fetch('https://cloudflare-dns.com/dns-query', {
method: 'OPTIONS',
});
let region = res.headers.get('cf-ray').split('-')[1]; // LHR
}
}
```
Would it be possible to expose cloudflare workers location perhaps from the Environment variables
```javascript
export default {
async fetch(request, { CF_REGION }) => {
console.log(CF_REGION); // LHR
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.