Skip to content
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

Get user's real IP address using package.json proxy #5094

Closed
shaysegev opened this issue Sep 25, 2018 · 4 comments
Closed

Get user's real IP address using package.json proxy #5094

shaysegev opened this issue Sep 25, 2018 · 4 comments

Comments

@shaysegev
Copy link

Is this a bug report?

Not sure

I love the use of proxy in package.json and it all works well, though I'd like to get the real user's IP address in the proxy request, though it always gets the local one 127.0.01 (which is understandable).

In Nginx, it is passed through a header such as x-forwarded-for.

I wonder if there's any implementation of passing the real IP address through the proxy?

Did you try recovering your dependencies?

Yes

Which terms did you search for in User Guide?

package.json proxy, react proxy ip address, react get ip address from proxy

Environment

Local environment

OS: Windows 10
Node: 8.11.2
Yarn: 1.5.1
npm: 5.6.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found

Live environment

OS: Linux 4.4
Node: 10.4.0
Yarn: 1.7.0
npm: 6.1.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found

Steps to Reproduce

No real steps here

Expected Behavior

Some documentation or implementation of how to get the user's IP address using the package.json proxy's feature.

Actual Behavior

Didn't find the IP address in the request (live server)
Remote and local addresses were both 127.0.0.1

Reproducible Demo

Not relevant (imo)

Thanks for any help!

@iansu
Copy link
Contributor

iansu commented Sep 25, 2018

You'll be able to define your own proxy middleware in version 2, which should be released soon. See here for details: #5073

@shaysegev
Copy link
Author

Thanks for your response @iansu , that would probably do.

@iansu
Copy link
Contributor

iansu commented Sep 25, 2018

Yeah, you can access the headers through the request object in your middleware function. I'll close this since it's resolved in 2.0.

@iansu iansu closed this as completed Sep 25, 2018
@Timer
Copy link
Contributor

Timer commented Sep 25, 2018

This is already released under the next beta (just switch to the next tag).

@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants