I'm hosting web application on AWS with Nginx 1.6.3 and django 1.7.6
I'd like to redirect www.mydomain.com to mydomain.com through Route 53
In other words, showing mydomain.com/foo on address bar when user typed www.mydomain.com/foo
Route 53 Configuration
mydomain.com
- Type : A record
- Value : ALIAS {Elastic Load Balancer A record}
www.mydomain.com
- Type : CNAME
- Value : mydomain.com
With above configuration, mydomain.com is well working but www.mydomain.com returns 400 Bad request error. Of course, I've tried it on secret mode(cache-free) with enough time interval(more than 24 hrs). Adding http:// at front returns same error.
server {
listen 80;
server_name www.mydomain.com;
return 301 $scheme://mydomain.com$request_uri;
}
If I added above code at nginx.conf, www.mydomain.com redirected to mydomain.com as I expected. However, I'm not sure that editing web server configuration is necessary to use CNAME service. How can I use CNAME service without editing web server?