linuxserver / docker-nextcloud

GNU General Public License v3.0
730 stars 127 forks source link

[BUG] Issue with Real IP when using Cloudflared Tunnel and a Proxy Service #471

Closed NoobOfAll closed 2 months ago

NoobOfAll commented 2 months ago

Is there an existing issue for this?

Current Behavior

The reported IP shows either the internal Proxy IP as the access IP or the Tunnel IP as the access IP

Expected Behavior

The final User IP should be visible

Steps To Reproduce

Use cloudlfared Tunnel to connect to a Reverse Proxy which sends the connection to Nextcloud

Environment

- OS:
- How docker service was installed:

CPU architecture

x86-64

Docker creation

Regular setup, nothing complicated

Container logs

Not really Needed, just checking the access log works, since I have solved the issue, logs wont help anymore, but not confident with my solution, I am submitting a bug with my solution, so that if it makes sense, you can make the update
github-actions[bot] commented 2 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

NoobOfAll commented 2 months ago

MY Solution

NGINX Site conf

Nextcloud/config/nginx/site-confs/default.conf

# display real ip in nginx logs when connected through reverse proxy via docker network
set_real_ip_from 172.28.1.24;
set_real_ip_from 192.168.0.10;    
real_ip_header X-Forwarded-For;
real_ip_recursive on;

The last line is needed for multiple IPs to be considered as internal IPs

drizuid commented 2 months ago

OP wrote their solution which will suffice, but i will note that putting our containers through cf tunnels, vpns, or proxy services are out of scope for us. Presumably you need the cloudflare real ip mod.. Closing this as out of scope for support.