Hi, while you're welcome to post here, this is not a general forum for Node. It's the community forum for NodeBB, a Node.js based forum software.
You'll probably have better luck with your question on StackOverflow or Reddit.
site.com - work
www.site.com - dont work
How do I solve this problem?
Redirect www. to site.com. They're two separate sub-domains, it's like expecting mail.site.com to redirect to site.com automatically.
Are you using apache or nginx?
@a_5mith Routing could not. Nginx.
@osman123 What's your nginx config for the routing?
server {
listen 80;
server_name site.com;
location / {
proxy_pass http://localhost:4567/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
What should I do?
@osman123 add this block to your nginx conf to redirect www.site.com to site.com
server {
listen 80;
server_name www.site.com;
return 301 http://site.com$request_uri;
}