-
Notifications
You must be signed in to change notification settings - Fork 218
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
feat: util getRequestIP
#503
Conversation
Codecov Report
@@ Coverage Diff @@
## main #503 +/- ##
==========================================
- Coverage 82.41% 82.40% -0.02%
==========================================
Files 31 31
Lines 3549 3580 +31
Branches 528 531 +3
==========================================
+ Hits 2925 2950 +25
- Misses 624 630 +6
|
Thanks for PR! I love it it is a must have util! /cc @danielroe @atinux @antfu about naming ideas. I like the current |
Nice! I like |
Agreed on And nice work. |
With the introduction of this utility, it's important to consider this issue #504 As you can see, it's common for module authors to be trusting easily spoofed headers atm. |
π Linked issue
#272
β Type of change
π Description
We should make it convenient for users to get the client request ip while being able to opt-in to trust the x-forwarded-for header.
Currently, users are implementing themselves:
I'm also open to naming this
getClientIp
orgetRequestClientIp
.This utility does open the door for trusting spoofable headers (see nuxt-security), sorting that is out of the scope of this utility, I'll open this as a seperate issue.
π Checklist