Haven’t experienced or tried to #resolve this issue myself, however I feel I’ll give it a try and point you in hopefully the right direction, seeing as this post has been here since July without a reply
You can find another thread post about this issue here on the Nextcloud forums which have a rather detailed discussion about how to possibly get this to work. They are using Docker, however it should still be possible to infer the solution for your system by reading through how they are #resolving it and where the configurations are made.
Here is the thread : How to get Real IP’s in logs