mattbeiswenger / smij.io

🔗 A really fast URL shortener
https://smij.io
2 stars 0 forks source link

Fix missing IP address #12

Open mattbeiswenger opened 12 months ago

mattbeiswenger commented 12 months ago

In order to perform rate limiting, the IP address is required as a unique identifier. After converting from a Next.js route to a server action, I'm unable to retrieve the IP address likely because there's additional information in the HTTP request that's needed to find the IP address whereas the server action only has access to form data. I will need to convert the serve action back to a regular route.

mattbeiswenger commented 12 months ago

Locally I'm not seeing any of the headers in my request that would be needed to determine my IP address. I can, however, see my remote address property which is only accessible on the request object. Here's the API documentation on how to retrieve the remote address on a Node request.

CleanShot 2023-09-24 at 20 52 17@2x
mattbeiswenger commented 11 months ago

Rewrote application to use bun runtime which doesn't have support for remote address yet so waiting on that

mattbeiswenger commented 11 months ago

v1.0.4 now has support for requestIp: https://github.com/oven-sh/bun/releases/tag/bun-v1.0.4

mattbeiswenger commented 7 months ago

Waiting on https://github.com/oven-sh/bun/issues/4660 to be complete for full support