trying to redirect all non-www traffic to www and all http traffic to https.
Environment is Magento 1.9 with Varnish and nginx. We also have Cloudflare (fully SSL enabled). Using the code below in vhosts, it doesn't redirect correctly - anybody see anything wrong?
Many thanks
server {
listen 80;
server_name www.example.com example.com;
return 301 https://www.example.com$request_uri;
}
server {
server_name example.com;
{{ssl_listener}};
{{ssl_certificate}};
{{ssl_certificate_key}};
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_session_timeout 10m;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
ssl_prefer_server_ciphers on;
ssl_stapling on;
ssl_stapling_verify on;
return 301 https://www.example.com$request_uri;
}