what is the right way to redirect all http://domain traffic to https://www.domain for magento 2 on nginx and varnish server?


1 Answer 1


Varnish is just caching and it doesn't affect the redirecting. To force www on Nginx check: https://stackoverflow.com/questions/32486739/force-www-and-https-in-nginx-conf-ssl?answertab=votes#tab-top

  • varnish is able to do everything, you can even run it without any webserver in upstream...
    – MagenX
    Commented Apr 30, 2018 at 6:56
  • so you're going to show us how you would recommend forcing www with varnish?
    – Eric
    Commented Apr 30, 2018 at 10:27
  • sure varnish-cache.org/trac/wiki/VCLExampleRedirectInVCL
    – MagenX
    Commented Apr 30, 2018 at 13:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.