Ip address trace

I’m in the middle of trying to protect myself from unwanted requests, so I thought about saving the client’s IP address to check if that client makes multiple requests, here’s my suggestion, but before a little background of my setup, I have front- end developed in react and deployed to icp along with backend services, so frontend always calls backend to do the work, ok now i hope installation is done, here is my suggestion:

From the front end I issue a call to, the method below:
public query func http_request(req: HttpRequest): async (HttpResponse) { …
When I call this method from the browser I get my IP directly, I dont know if it is going to work the same way when it is deployed and called as a method from the frontend ( not sure )

the http_request respond with IP address, I take the IP adress and call another shared function to add the trace, the share function can save the ip and return ok or block the user and returns error, the function looks as below:
public shared func prepare_request(ipAdress: Text): async Result<RequestInfo, Text> {

Is this a good approach?

I don’t think this would work as DoS protection as the IP address can be easily spoofed (you seem to plan including it in the IC call argument and there’s no validation that the IP address in that argument matches the actual IP address of the call’s sender).