Domain issue.



  • I'm currently logged using www.example.com on my browser, then when I browse my site in another tab without www like example.com it show that i'm not already log on my site.

    Thanks, 👍



  • @humanmadeaccount said:

    I'm currently logged using www.example.com on my browser, then when I browse my site in another tab without www like example.com it show that i'm not already log on my site.

    Thanks, 👍

    www.example.com and example.com are different subdomains, are you using nginx or apache for your reverse proxy? Either way, you need to route one to the other. Either all example.com to www.example.com or all www.example.com to example.com



  • I'm using nginx. Same settings in NodeBB Docs.

    like this..

    server {
        listen 80;
    
        server_name example.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";
        }
    }
    

    what is the right settings in nginx? thanks again. 😄



  • Assuming you want it to be example.com and not www.example.com. My method was to make a new file in sites-available called redirect (sudo nano redirect) inside /etc/nginx/sites-available

    Paste the following

    server {
        listen 80;
        server_name www.example.com;
    
        return 301      http://example.com$request_uri;
    }
    

    Then save, run sudo ln -s /etc/nginx/sites-available/redirect /etc/nginx/sites-enabled

    Then run sudo service nginx reload

    Make sure you get an [OK] and you should be good to test. You can add it to the existing file, but I prefer keeping each thing seperated as it makes it easier to debug issues.



  • Thank you so much. I'll try this one. 👍


 

Suggested Topics

| |