Client IP is seen as router IP by server when requesting server using public IP/domain by same-network client

Solution 1:

But when I connect from the same client to the server either using the public IP address or the domain name, the NGINX access logs shows the IP address from the router: 192.168.2.254.

Why does this happen? This way I cannot log (and act on) which internal clients connect to the server.

This happens because when you connect to the public IP address (or public domain name which uses the public IP address), the connection goes from your client (192.168.2.2), to the router (192.168.2.254), then the router NATs the source address of the connection to it's own interface, i.e. to the IP address of interface closest to destination.