• 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

Login Sessions always 127.0.0.1

Scheduled Pinned Locked Moved Solved Technical Support
3 Posts 2 Posters 1.2k 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.
  • ToeiReiT Offline
    ToeiReiT Offline
    ToeiRei
    wrote on last edited by
    #1

    Hi guys,

    I got a nasty problem with nodebb and nginx reverse proxying as nodebb logs every IP as 127.0.0.1
    Any ideas what I'm doing wrong?

    config.json

    {
       "url":"http://board.domain.com",
       "use_port": false,
       "secret":"some secret",
       "mongo":{
          "username":"",
          "host":"databasehost",
          "password":"mypw",
          "port":"27017",
          "database":"nodebb"
       },
       "database":"mongo"
    }
    

    nginx:

    server {
            listen 80;
    
            server_name board.domain.com;
            return 301 https://$host$request_uri;
    }
    
    upstream board {
            server 127.0.0.1:4567;
    }
    
    server {
            listen 443 ssl http2;
            gzip off;
    
            ssl on;
            ssl_certificate /path/to/fullchain.pem;
            ssl_certificate_key /path/to/privkey.pem;
            ssl_dhparam ssl/dhparam-board.pem;
    
            server_name board.domain.com;
    
            access_log syslog:server=syslog:12301 graylog2_format;
            error_log syslog:server=syslog:12302;
    
    
            location / {
                    proxy_set_header                X-Real-IP $remote_addr;
                    proxy_set_header                X-Forward-For $proxy_add_x_forwarded_for;
                    proxy_set_header                X-Forward-Proto http;
                    proxy_set_header                Host $http_host;
                    proxy_set_header                X-Nginx-Proxy true;
    
                    proxy_pass                      http://board;
                    proxy_redirect off;
    
                    # Socket.IO
                    proxy_http_version              1.1;
                    proxy_set_header                Upgrade $http_upgrade;
                    proxy_set_header                Connection "upgrade";
    
            }
    
    
    }
    
    
    1 Reply Last reply
    0
  • phitP Offline
    phitP Offline
    phit
    wrote on last edited by phit
    #2

    your site is https, but you are using http in the configs

    "url":"http://board.domain.com", needs to be "url":"https://board.domain.com",

    this is the part that makes the ips not show up
    proxy_set_header X-Forward-Proto http;
    should be either
    proxy_set_header X-Forwarded-Proto https;
    or better
    proxy_set_header X-Forwarded-Proto $scheme;

    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
    should be
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    theres some explanation for those headers here:
    https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto

    https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For

    1 Reply Last reply
    2
  • ToeiReiT Offline
    ToeiReiT Offline
    ToeiRei
    wrote on last edited by
    #3

    Thanks a ton. Lesson learned: 3 o' clock in the morning isn't good for migration stuff.

    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