• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Forwarding IPs on nginx proxy

Scheduled Pinned Locked Moved General Discussion
nginxproxy
7 Posts 3 Posters 3.8k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • markkusM Offline
    markkusM Offline
    markkus GNU/Linux
    wrote on last edited by
    #1

    Hey, can anyone tell me how can I forward the real IPs to NodeBB when running the forum behind nginx proxy? At the moment, every user has the local IP 127.0.0.1 displayed as the ''Recently Logged In IP''.

    1 Reply Last reply
    0
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #2

    i have the same problem.. but i can't fix it...
    maybe can @a_5mith help ?

    A 1 Reply Last reply
    0
  • A Offline
    A Offline
    a_5mith
    replied to A Former User on last edited by
    #3

    Verify you have

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    in your nginx file in sites-available, if you do, can you paste your nginx file for me to look at (you can remove the site url if you need to (but make it clear if you've used localhost or siteurl.com))

    also make sure use_port is set to false in your nodebb config.json file.

    1 Reply Last reply
    2
  • markkusM Offline
    markkusM Offline
    markkus GNU/Linux
    wrote on last edited by markkus
    #4

    @a_5mith There... Maybe I should change proxy_pass?

    server {
    listen 80;
    server_name forum.domain.com;
    
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
    
        proxy_pass http://127.0.0.1:4567/;
        proxy_redirect off;
    
        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    }
    
    A 1 Reply Last reply
    0
  • A Offline
    A Offline
    a_5mith
    replied to markkus on last edited by
    #5

    @markkus Try it, if you get a 502, set your base_url to match, but without the port number.

    1 Reply Last reply
    0
  • markkusM Offline
    markkusM Offline
    markkus GNU/Linux
    wrote on last edited by
    #6

    Alright, got it working. So here is the list of things that I tweaked:

    "base_url": "http://forum.domain.com" in NodeBB config.

    use_port is set to false in NodeBB config.

    proxy_pass http://123.456.789.10:4567/; in nginx config. (so that it matches the droplet's IP)

    A 1 Reply Last reply
    0
  • A Offline
    A Offline
    a_5mith
    replied to markkus on last edited by a_5mith
    #7

    @markkus Sounds good to me. 👍 Hopefully this also solves @helltux's issue too.

    Assuming he correctly substitutes his IP in proxy_pass and his domain name in base_url. 😆

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development