I have a setup where Apache listens on port 8080 behind Varnish 4 on port 80, but my client needs ssl working on the site so I setup Nginx for SSL termination on port 443 using this guide.
Everything works fine at first on http, but on attempting to load the site on https, scripts required by the site won't load, So I decided to change the site url in Settings > General
to an https url, on saving changes, I get a redirect loop error in Chrome.
I couldn't access the site's wordpress dashboard to change the url back so I had to do it via phpmyadmin. But now when the site is accessed via https, the site breaks cause the scripts it requires to render content aren't authenticated.
Someone else has the same issue here but it doesn't look like it was solved.
How can I have the site on just https
without a redirect loop in Chrome?
After hours of trying to get this to work, I finally found a fix, all I had to was add an
HTTP_X_FORWARDED_PROTO
in mywp-config.php
just before changing the site url, this way:One more thing I had to do was to add
proxy_set_header X-Forwarded-Protocol $scheme;
to mydefault
file in/etc/nginx/sites-enabled/default
so it looks like this:Hope this helps someone out there.