nginx reverse proxy SSL



  • Hey guys...

    We are having a reverse nginx proxy on front of everything here and we used it with another nodeJS project and works fine.

    But with nodeBB it's not working. We are having a lost connection.

    In config.json we put the https in the URL and our nginx config looks like:

        listen 80;
        listen 443 ssl http2 proxy_protocol;
        ssl_certificate /etc/ssl/private/smarthome.community.crt;
        ssl_certificate_key /etc/ssl/private/smarthome.community.key;
    
        server_name smarthome.community www.smarthome.community;
        root /vhosts/default;
    
        #if ($scheme = http) {
        #    return 301 https://$server_name$request_uri;
        #}
    
        access_log off;
    
        client_max_body_size 50M;
    
        # Dynamic content, forward to Apache
        location / {
            proxy_pass http://IP:port;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $http_host;
    
            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 $scheme;
            proxy_set_header X-Nginx-Proxy true;
    
            proxy_redirect off;
            proxy_buffering   off;
        }
    
    

    We used the same config with another nodeJS project!



  • I use this

    proxy_pass http://127.0.0.1:4567;  # no trailing slash

  • Plugin & Theme Dev Community Rep

    Just a question: are you using some kind of load balancer or another proxy in front that requires PROXY protocol? Because it seems that for me this option doesn't let me connect to NodeBB (I don't have any load balancer/proxy in front of Nginx). Perhaps try changing it to just listen 443 ssl http2; and test if that works?



  • @oplik0 yeah we are having a loadbalancer before nginx!

    using nodebb without SSL works perfectly using load balancer -> nginx -> nodebb

    I would need to do some more testing but I saw that when using SSL , it redirect to www.domain.tld instead of domain.tld!

    I just modify the nginx config for this vhost to send www. to non-www. and I will re-active the SSL!

    The other thing is, I tried to add

    "socket.io": {
        "origins": "https://community.nodebb.org:* https://nodebb.org:*"
      }
    

    to the config.json and I got an error when starting nodebb


Log in to reply
 

Suggested Topics

  • 2
  • 7
  • 6
  • 2
  • 2
| |