wp-config.php » How to set up WordPress behind a secure reverse proxy using Nginx

How to set up WordPress behind a secure reverse proxy using Nginx

The Really Simple Security plugin (formerly Really Simple SSL) is a useful tool, but it tends to overcomplicate SSL configuration. When running WordPress behind multiple proxies—especially those handling SSL termination like Varnish—the following configuration is usually sufficient to eliminate mixed content errors and prevent infinite redirect loops:


FORCE_SSL_ADMIN

Add FORCE_SSL_ADMIN true in wp-config.php to tell the back-end (wp-admin) to use https for all links, even if it receives requests via plain http.

Add the following in wp-config.php file:

define('FORCE_SSL_ADMIN', true); if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';
2025 05 16 16 46 - How to set up WordPress behind a secure reverse proxy using Nginx
FORCE_SSL_ADMIN in wp-config.php

X-Forwarded-Proto

Make sute the proxy is sending the X-Forwarded-Proto header with https;

proxy_set_header X-Forwarded-Proto https;

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

Recommended