OPNsense Forum

English Forums => Web Proxy Filtering and Caching => Topic started by: toomanylogins on June 09, 2021, 06:06:23 pm

Title: WordPress mixed content error
Post 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
Title: Re: WordPress mixed content error
Post by: fabian on June 09, 2021, 09:42:29 pm
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
Title: Re: WordPress mixed content error
Post by: toomanylogins on June 10, 2021, 11:30:37 am
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';
Title: Re: WordPress mixed content error
Post by: LarryP on April 19, 2023, 04:45:26 am
Thank you!
That was so helpful getting my WP site working.
Title: Re: WordPress mixed content error
Post by: Mikuro on November 27, 2023, 10:28:55 am
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.