Nginx (http + https) on the front with varnish behind

httpsnginxvarnish

I have have a nginx server serving http and https and I have varnish behind to cache the apache requests

nginx (80+443) -> varnish (6081) -> apache (8081)

when I serve pages using 443, pages are already cached with port 80 (image references etc)
therefore browser alerts saying there is some encrypted and unencrypted content on the page.

I cant use relative URLS.

is there a config i can keep in vcl so that it uses different hash for https requests.

Best Answer

Why three tiers? It's making your site significantly slower than it need be.

when I serve pages using 443, pages are already cached with port 80

No - you're just mixing HTTP and HTTPS urls on your page.