basilhendroff / truenas-iocage-wordpress

Script to install WordPress in an iocage jail including MariaDB, the PHP scripting language, Caddy, Redis and phpMyAdmin.
GNU General Public License v3.0
6 stars 6 forks source link

CSS Errors when behind reverse proxy. #19

Open tschettervictor opened 1 year ago

tschettervictor commented 1 year ago

Since Caddy 2.5.0 need to specify trusted_proxies to the wordpress caddyfile to get the CSS to load properly. I added trusted_proxies private_ranges inside the phpfastcgi block, and it started working.

I also added (not sure if this was necessary.)

define('.COOKIE_DOMAIN.', 'www.mydomain.com'); define('.SITECOOKIEPATH.', '.');

if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']); $_SERVER['REMOTE_ADDR'] = $list[0]; } define( 'WP_HOME', 'https://www.mydomain.com' ); define( 'WP_SITEURL', 'https://www.mydomain.com' ); $_SERVER['HTTP_HOST'] = 'www.mydomain.com'; $_SERVER['REMOTE_ADDR'] = 'https://www.mydomain.com'; $_SERVER[ 'SERVER_ADDR' ] = 'www.mydomain.com';

if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';

at the beggining of the /usr/local/www/wordpress/wp-config.php according to this replacing the mydomain part with my custom url from the reverse proxy.