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_session_cache  builtin:1000  shared:SSL:10m;
  ssl_session_timeout  10m;
  ssl_protocols TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;
  ssl_stapling on;
  ssl_stapling_verify on;
  return 301 https://www.example.com$request_uri;
  • You shouldn't use Magento 1.x with Turpentine's Varnish implementation unless you accept a bunch of security issues (disable CSRF), else every first-page visit will be uncached. See here. Apr 20, 2020 at 20:59
  • Thanks for the update. Decided we're going to disable Varnish
    – RHNC
    Apr 21, 2020 at 15:37


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.