"leaving-subdomain" alert when connecting to a rootdomain link



  • This post is deleted!


  • I couldn't edit my first post since the board forces me to give a topic name but there already is one so I deleted my first post and reply a 2nd edited one:

    Hey guys,

    when I login to my nodebb by using the subdomain http://www.domain.com, I get an alarm saying "you're leaving www.domain.com" when trying to connect to a link given in a topic wich uses the rootdomain http://domain.com/link. Any ideas how to get rid of this?

    my nginx conf:

        listen 80;
    
        server_name 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";
        }
    }
    server  {
        server_name  www.domain.com;
        rewrite ^(.*) http://domain.com$1 permanent;
            }
    }```

  • GNU/Linux Admin

    @efkay you'll want to redirect all requests from one to the other. Add a new server block:

    server {
        listen 80;
        server_name www.domain.com;
    
        return 301 domain.com$request_uri;
    } 
    

    Keep in mind I wrote this while at the gym, so check for syntax errors 🙂



  • @julian said:

    @efkay you'll want to redirect all requests from one to the other. Add a new server block:

    server {
        listen 80;
        server_name www.domain.com;
    
        return 301 domain.com$request_uri;
    } 
    

    Keep in mind I wrote this while at the gym, so check for syntax errors 🙂

    Pumping dat iron. Avoiding syntax errors.



  • @julian thanks for the reply! I'm not sure if you mean that I simply have to add the server under my given config or integrate it like the already given server www.domain.com. I've had problems first because I had to login twice when I switched domains, this problem got solved by the rewrite... permanent option:

        listen 80;
        server_name  www.domain.com;
        rewrite ^(.*) http://domain.com$1 permanent;
        return 301 domain.com$request_uri;
            }


  • @julian: I've tried to simply add you server lines to my existing config but the problem still exists. can you please tell me if the combination of code I've written in my previous post is correct?


  • GNU/Linux Admin

    @efkay no need for the rewrite, and this is a new server block to go alongside your existing block



  • Here is my current nginx config, problem with the warning that I'm leaving our www.domain.com board to domain.com still exist:

    server {
        listen 80;
    
        server_name 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";
        }
    }
    server  {
        server_name  www.domain.com;
        rewrite ^(.*) http://domain.com$1 permanent;
            }
    server  {
        listen 80;
        server_name www.domain.com;
    
        return 301 domain.com$request_uri;
    }

Log in to reply
 

Suggested Topics

| |