OPNsense Forum
English Forums => Web Proxy Filtering and Caching => Topic started by: toomanylogins on June 09, 2021, 06:06:23 pm
-
When using the nginx plugin for WordPress site where the certificate is served by nginx and the apache server running behind a proxy is using http WordPress gives a mixed content error. There are numerous examples of this on the Internet. The answer apparently is to include
proxy_set_header X-Forwarded-Proto https;
However not sure how to incorporate this in the settings.
Any idea
thanks
Paul
-
It should be already there. However the backend server should process it as well.
Note: nginx will forward what it gets (http or https)
https://github.com/opnsense/plugins/blob/master/www/nginx/src/opnsense/service/templates/OPNsense/Nginx/location.conf#L165
-
Thanks for reply. This turned out to be a WordPress issue. For anybody with the same problem insert this code at the top of the wpconfig file
/** SSL */
define('FORCE_SSL_ADMIN', true);
// in some setups HTTP_X_FORWARDED_PROTO might contain
// a comma-separated list e.g. http,https
// so check for https existence
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';
-
Thank you!
That was so helpful getting my WP site working.
-
Another tip is to check out custom cms vs wordpress (https://webcapitan.com/blog/wordpress-vs-custom-cms/). Evaluate the factors mentioned here to determine which option aligns best with your needs and goals.