Dockered nextcloud behind host nginx reverse Proxy

I have just done my first setup of a dockerized nextcloud server with basically this setup:

which is basically:
dockered_nginx -> dockered_nextcloud

Since I want to use several servers on this host and use sobdomains to forward the clients to the specific host, I use a host nginx reverse proxy before the setup:

host_nginx -> dockered_nginx -> dockered_nextcloud

The setup works fine, BUT all the accesses to the nextcloud instance come from the internal IP of the dockered_nginx container

So if ANY user makes wrong login attemts, Nextcloud slows down the login process for ANY user, since every user has the IP of the dockerized_nginx container.
I realized it when I wanted to install fail2ban based on the log in


Which is not possible, because there is always just the IP of the nginx container shown.
Is there any way how I can overcome this issue?

This is a part of my host nginx.conf:

 server {

location / {
	proxy_set_header 	Host $host;
	proxy_set_header	X-Real-IP $remote_addr;
	proxy_set_header	X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_read_timeout	180s;


Can anybody help me here or give me a hint how to overcome this issue?


A little sidenote: I could circumvent this issue by just using the apache based nextcloud image from:

With this I see the real IP with the same setup (nginx reverse proxy) as before.
I don’t know why this doesn’t work with the fpm version of nextcloud.