Disallowedhost At / Invalid Http_host Header: 'www.example.com'. You May Need To Add 'www.example.com' To Allowed_hosts
I have deployed a Django project in digitalocean ubuntu 16.04.My domain name is like example.com Because I want to add www. in front of my domain name so that if input www.example.
Solution 1:
I just solved it by following this tutorial https://www.digitalocean.com/community/tutorials/how-to-redirect-www-to-non-www-with-nginx-on-ubuntu-14-04#configure-nginx-redirect
One thing need to be noticed is the form:
You should use:
server {
server_name www.domain.com;
return301$scheme://domain.com$request_uri;
}
server {
server_name domain.com;
[...]
}
Post a Comment for "Disallowedhost At / Invalid Http_host Header: 'www.example.com'. You May Need To Add 'www.example.com' To Allowed_hosts"