-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to get client IP or request protocol in development mode #324
Comments
Are you checking log in development mode or when deploying? (if deployed, what preset) For dev, see nitrojs/nitro#1978 it is fixed in nightly channels you can try nuxt nightly. |
I'm testing in development mode, with "dev": "nuxt dev --host 0.0.0.0" to expose on the network, but the IP stays undefined regardless of how I access the Nuxt site (localhost:3000 / 127.0.0.1:3000 / my-ip:3000 ) Thank you for the hint but switching to nightly unfortunately didn't affect this issue ._.
the result of middleware execution is is:
|
I suspect this might be bug in nuxt CLI's proxy. Will investigate more. In the meantime, can you also try |
Adding (By the way, is there documentation about this command argument and what does it affect?) |
Thanks for confirming. Using |
Current workaround:
|
fix should have been landed in latest nitro, try upgrading with |
@pi0 I’m getting “http” from getRequestProtocol even though my server is running https. |
@c0nd3v ~> #487 |
Environment
[2:31:36 PM] Nuxt project info:
Reproduction
Nuxt project with a middleware and a plugin, both failing to get a client IP:
https://github.com/xtance/nuxt-app-ip/
As compared to the blank h3 app:
https://github.com/xtance/h3-app-ip
Describe the bug
I'm trying to get client IP address from an event and it couldn't show it. The only way is to read
x-forwarded-for
header and there it's always 127.0.0.1It returns "IP undefined undefined undefined undefined 127.0.0.1" (I also tried with a server plugin in /plugins/server)
Since I read that nuxt uses h3 I created a blank project to test it and it shows my real IP. (See in reproduction section)
Additional context
I was wondering if I'm alone with this issue but here is a discussion: nuxt/nuxt#25059
Logs
No response
The text was updated successfully, but these errors were encountered: