-
Notifications
You must be signed in to change notification settings - Fork 368
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: add client ip header to edge func local dev #4681
Conversation
📊 Benchmark resultsComparing with 3bfbe87 Package size: 294 MB(no change)
Legend
|
src/lib/edge-functions/proxy.js
Outdated
@@ -116,6 +116,7 @@ const initializeProxy = async ({ | |||
[headers.ForwardedHost]: `localhost:${mainPort}`, | |||
[headers.Passthrough]: 'passthrough', | |||
[headers.RequestID]: generateUUID(), | |||
[headers.IP]: '127.0.0.1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the LOCAL_HOST
constant.
[headers.IP]: '127.0.0.1', | |
[headers.IP]: LOCAL_HOST, |
…into addClientIPHeaderToLocalDev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
🎉 Thanks for submitting a pull request! 🎉
Summary
See https://github.com/netlify/stargate/issues/414
Adds 'x-nf-client-connection-ip' header to edge functions proxy requests to mimic production change merged in https://github.com/netlify/stargate/pull/548
I did hard code '127.0.0.1' as the IP value, as there isn't really a way other than randomizing IPs to simulate the client IPs. We can update this as needed, or if decided to go another route.
For us to review and ship your PR efficiently, please perform the following steps:
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)