Issue with SSL when using nginx reverse proxy
-
I’ve got a brand new WP site up and running, and it works just fine over http through my nginx reverse proxy. The problem comes when I secure it (using LetsEncrypt). I’ve configured both the nginx configuration file and the wp-config.php files to get it to work (seemingly), but it won’t let me login. The site displays just fine over https, but when I try to logon, it says invalid user or password. The same credentials work just fine over http.
Additions to wp-config.php:
if ($_SERVER[‘HTTP_X_FORWARDED_PROTO’] == ‘https’)
$_SERVER[‘HTTPS’]=’on’;
if (isset($_SERVER[‘HTTP_X_FORWARDED_HOST’])) {
$_SERVER[‘HTTP_HOST’] = $_SERVER[‘HTTP_X_FORWARDED_HOST’];
}Additions to nginx conf file:
location / {
…
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
…
}
The topic ‘Issue with SSL when using nginx reverse proxy’ is closed to new replies.