Client IP not showing in NGINX logs

  • I have a server OMV behind my router (which has internal IP 192.168.10.1) and use port forwarding to forward public ports 80 and 443 to my (OMV) server.

    The router Xiaomi Wi-Fi Router Redmi AC2100 with Padavan firmware

    I can access that server either by typing in it's public IP (say 80.81.82.83) or by going to a domain (say example.org).

    I use NGINX (SWAG) on that server as a reverse proxy to delegate the request to the appropriate (web) applications on the same server.


    Thу problem is that real Client IP not showing in NGINX logs, and i cant use fail2ban.


    If i open any my sites in Nginx logs i see IP 192.168.10.1

    EXAMPLE ACCESS.LOG

    Code
    192.168.10.1 - - [07/Dec/2022:21:08:05 +0300] "GET /app/3rdparty/workbox/workbox-sw.js HTTP/2.0" 200 1359 "https://music.burjuy.xxxx/app/navidrome-service-worker.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.62"


    The problem is that router doesnt transmitt client IP to internal server.

    • Official Post

    It must be how you are doing your port forwarding and/or NAT on the router or the proxy (not an OMV issue). I don't have this issue with my nginx server behind a router.

    omv 7.7.9-1 sandworm | 64 bit | 6.11 proxmox kernel

    plugins :: omvextrasorg 7.0.2 | kvm 7.1.6 | compose 7.6.6 | cterm 7.8.5 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.2


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • It must be how you are doing your port forwarding and/or NAT on the router or the proxy (not an OMV issue). I don't have this issue with my nginx server behind a router.

    Thanks for quick reply, I did normal port forwarding from Wan to OMV, Nothing else.

    • Official Post

    Thanks for quick reply, I did normal port forwarding from Wan to OMV, Nothing else.

    I have no idea how your router works but you do have something else - your proxy. I don't use swag so I don't know much about it.

    omv 7.7.9-1 sandworm | 64 bit | 6.11 proxmox kernel

    plugins :: omvextrasorg 7.0.2 | kvm 7.1.6 | compose 7.6.6 | cterm 7.8.5 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.2


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Does your public IP have a connection with the domain? you have to enter this at the provider

    The problem was on my router, i found rule in iptables

    iptables -t nat -I POSTROUTING -o br0 -j MASQUERADE

    Ive removed it and everytnig works now.

    Thanks for your intention

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!