I have my Nginx conf set up as follows:
server {
listen 443 ssl;
server_name mydomain.com;
...
}
When I load https://mydomain.com
, the site loads fine.
But when I load https://www.mydomain.com
, the site loads as well. Why is this happening?
I set up the DNS records using Amazon Route 53 as:
A mydomain.com xxx.xxx.xxx.xxx (IP)
CNAME www.mydomain.com mydomain.com
So is a request to www.mydomain.com
arriving at Nginx as a request to mydomain.com
?
If so, how do I differentiate requests to www.mydomain.com
and mydomain.com
at my server?