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

feat: add an API to inspect request's IP address #110

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented Oct 23, 2023

The new endpoint tells the caller what IP addresses we see, as coming from
the IP stack, Fly.io and CloudFare. This is useful to verify our understanding
of how all reverse proxies interact together.

Links:

@bajtos bajtos requested a review from juliangruber October 23, 2023 09:10
@bajtos bajtos merged commit 32a264a into main Oct 23, 2023
@bajtos bajtos deleted the debug-remote-ip-address branch October 23, 2023 09:13
@bajtos
Copy link
Member Author

bajtos commented Oct 23, 2023

Works like a charm:

{
  "remoteAddress": "172.16.133.194",
  "flyClientAddr": "141.101.96.93",  
  "cloudfareAddr": "77.X.Y.Z",
  "forwardedFor": "77.X.Z.Z, 137.66.43.45",
  "headers": // ...
}
  • 172.16.133.194 is a private address (presumably in Fly.io's datacenter)
  • 137.66.43.45 is Fly.io
  • 141.101.96.93 is CloudFare

@juliangruber
Copy link
Member

btw, I see only my ipv6 here:

{
"remoteAddress": "172.16.147.122",
"flyClientAddr": "172.68.110.118",
"cloudfareAddr": "2a01:...:5afc",
"forwardedFor": "2a01:...:5afc, 137.66.43.45",
...
}

Not sure if that affects your work

await json(res, {
remoteAddress: req.socket.remoteAddress,
flyClientAddr: req.headers['fly-client-ip'],
cloudfareAddr: req.headers['cf-connecting-ip'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: cloudflareAddr

@bajtos
Copy link
Member Author

bajtos commented Oct 24, 2023

Oh, wow. CloudFlare's dashboard does not allow you to disable IPv6 support via web UI and the docs say this feature is available to customers on the Enterprise plan only. Yet the REST API allows me to disable IPv6, as explained here: https://www.mediarealm.com.au/articles/cloudflare-disable-ipv6/

@juliangruber when you have a moment, could you please send another request to this new endpoint to see if you get back an IPv4 address (not IPv6)?

Related docs:

If this approach does not work, then I'll try the next quick workaround that should be good enough for short term:

@juliangruber
Copy link
Member

@juliangruber when you have a moment, could you please send another request to this new endpoint to see if you get back an IPv4 address (not IPv6)?

Success!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ done
Development

Successfully merging this pull request may close these issues.

2 participants