Replies: 6 comments 2 replies
-
You would need to extract & proxy them at the point of your |
Beta Was this translation helpful? Give feedback.
-
I'm also curious about this one. Can't seem to get the client's IP from the server request. |
Beta Was this translation helpful? Give feedback.
-
also interested, i have a export default defineEventHandler((e) => {
console.log(e.node.req.socket.remoteAddress || e.node.req.headers["x-forwarded-for"])
return ""
}); but i only get empty string or |
Beta Was this translation helpful? Give feedback.
-
Did anyone solve this? |
Beta Was this translation helpful? Give feedback.
-
We've had succes with the following: Also don't forget that the XFF can be multiple values (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For), so you'll need to extract the first value or the one you need. You can find more documentation on the h3 github: https://github.com/unjs/h3 |
Beta Was this translation helpful? Give feedback.
-
I'm sorry for the stupid question, but I don't understand... I need to pass the user's IP as one of the signature attributes in my service. In setup, I get an ip using I save the value of the variable, I see the ip. But when I try to pass a value to a useFetch of the post type, I get undefined, while the ip is output in the template without problems. Can someone suggest a way around this or suggest a solution? |
Beta Was this translation helpful? Give feedback.
-
Environment
Windows_NT
v16.14.0
3.0.0-rc.1
[email protected]
vite
runtimeConfig
-
-
👉 Report an issue: https://github.com/nuxt/framework/issues/new 17:22:54
👉 Suggest an improvement: https://github.com/nuxt/framework/discussions/new
👉 Read documentation: https://v3.nuxtjs.org
Reproduction
just installed / pure nuxt 3
Describe the bug
how can i get client's ip address when fetch data?
it works when data fetching on client side but not server side
i tried this
both failed to read client's ip..
please let me know if i missed something. thanks
Additional context
No response
Logs
No response
Beta Was this translation helpful? Give feedback.
All reactions