NGINX Varnish SSL - too many redirects
You need to configure your SSL terminator as reverse proxy:
in your nginx ssl configuration, add this:
location / {
proxy_pass http://VARNISH-IP-ADDR-OR-HOSTNAME;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Nginx on;
proxy_redirect off;
}
Then, in your varnish vcl file
if ( req.http.X-Nginx != "on") {
return (synth(750, ""));
}
...
sub vcl_synth {
if (resp.status == 750) {
set resp.status = 301;
set resp.http.Location = "https://YOUR-SSL-FQDN" + req.url;
return(deliver);
}
}
Last: for wordpress, in wp-config.php add these lines:
define('FORCE_SSL_ADMIN', true);
$_SERVER['HTTPS']='on';
NOTE: I'm assuming your other varnish configuration is good and your nginx "8080" configuration is good for your php application.