-
Notifications
You must be signed in to change notification settings - Fork 10
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
Improve Fly.io client IP detection with Node / Express #1754
Comments
If the |
You need to build ArcjetHeaders with the |
This case is unusual because There's an argument to say that you shouldn't be using Arcjet against health checks, but I think we'll see this with a lot of monitoring & deployment systems. The current behavior seems correct to me - if we can't determine the public IP then we have to error (unless you can think of a way around it?). So the question is: what is our recommended workaround if you want to have Arcjet run on every endpoint (including the health check)? Bogon check + looking at the user agent? |
Why does there need to be a workaround? If Something else related to this: if we can't build characteristics, we should probably just avoid sending to the service at all—and the workaround for that would be to use a different characteristic. |
Yeah the errors in the logs are disconcerting, and could be verbose if they're doing regular health checks from multiple locations. This is more about how we improve the DX around this scenario rather than it being a change to how our core functionality works i.e. what's our official recommendation that would go in the docs? |
I think:
Do you think anything else needs to be done? |
Agreed on both. I've added arcjet/arcjet-docs#96 for the docs. |
I've opened #1801 to handle the validation of characteristics for the fingerprint so I think we can close this. |
On Fly.io, the client IP address in
req.ip
provided by Express.js is always an internal IP address e.g.::ffff:172.16.21.10
. This causes the request to be rejected by Arcjet when in production mode.To pass the correct IP, we have to construct a custom request object e.g:
The correct IP can then be detected by Arcjet. I couldn't use the https://github.com/arcjet/arcjet-js/tree/main/ip package because
req.headers
is not the expected format:The text was updated successfully, but these errors were encountered: