1
this is related to:
https://stackoverflow.com/questions/24538973/django-allowed-hosts-error-for-www-domain-and-ip-address
i'm attempting to redirect www and non-ssl requests to ssl non-www domain for my site. i'm running nginx for front end webserver
unfortunately i continue to have a couple issues:
* if i run https://www.domain.com, i get an http400
* i still get errors from underlying application that it is recieving requests on www.domain.com and < ipaddress >
Can someone help point out what is wrong with my conf below?
server {
listen <ip address>:80;
server_name "";
return 444;
}
server{
listen <ip address>:80;
server_name www.domain.com;
return 301 $scheme://domain.com$request_uri;
}
#HTTPS server
server{
listen <ip address>:80;
listen <ip address>:443 ssl;
server_name domain.com;
location / {
uwsgi_pass unix:<path to socket file>;
include /etc/nginx/uwsgi_params;
}
if ($ssl_protocol = ""){
return 301 https://$host$request_uri;
}
}