This question already has an answer here:

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

marked as duplicate by Manoj Deswal, Manashvi Birla, Giel Berkers, liyakat, Priyank Apr 30 '18 at 8:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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

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