How to access cloudflare location details in nitro #525
Unanswered
pateltoral
asked this question in
Q&A
Replies: 1 comment
-
I created PR for CF support, you can access via |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can I access cloudflare object from request to get location details?
Environment
Operating System: Windows
Node Version: v16.15.0
Nuxt Version: 3.0.0-rc.8
Nitro Version: 0.4.24
Package Manager: yarn
cloudflare/wrangler: 2.1.5
miniflare for local
miniflare do cache Request.cf
Code tried:
/server/routes/location.ts
export default defineEventHandler(async (event) => {
console.log(event.req.cf.latitude) // Error: cf not part of IncomingMessage
})
wrangler.toml
name = "location-worker"
account_id = ""
workers_dev = true
compatibility_date = "2022-04-05"
main = "./.output/server/index.mjs"
[env.dev]
name = "location-worker-dev"
[site]
bucket = ".output/public"
Commands executing:
yarn build
yarn miniflare .output/server/index.mjs --site .output/public
How to get cf latitude in nuxt3 nitro server routes?
Beta Was this translation helpful? Give feedback.
All reactions