1

I have installed varnish and nginx and secured my website with lets encrypt SSL. I tested varnish against nginx cgi cache and i have found out that varnish is a bit faster in my use case (wordpress). So i need some help on how to use nginx for SSL termination with varnish and how to forward http to https as my website is https only. I am running ubuntu 18.04

1
  • Anyone? Please help me out. Commented Sep 5, 2019 at 15:21

1 Answer 1

1

Add the below lines in /etc/varnish/default.vcl

sub vcl_recv { if ( (req.http.host ~ "^(?i)www.yourdomain.com" || req.http.host ~ "^(?i)www.yourdomain.com") && req.http.X-Forwarded-Proto !~ "(?i)https") { return (synth(750, "")); } } sub vcl_synth { if (resp.status == 750) { set resp.status = 301; set resp.http.Location = "https://www.yourdomain.com" + req.url; return(deliver); } } 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.