Caddy Reverse Proxy Headache

I am trying to proxy services behind caddy and then plubish them through subdomains of my domain. I have tried deploying differing versions of the wordpress container, including :latest, and specific versions of php (this chages nothing). I believe this is related to how the wp-config.php file is configured to handle https rewrites through the proxy, since I do expierence a login loop when trying to do so.

This is the site https://allofmy.work
As you can see it, it’s only outputting text

<?php
define('FORCE_SSL_ADMIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
     $_SERVER['HTTPS']='on';
/**
  * The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://codex.wordpress.org/Editing_wp-config.php
*
* @package WordPress
*/

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'haha');

/** MySQL database username */
define('DB_USER', 'nah');

/** MySQL database password */
define('DB_PASSWORD', 'you thought');

/** MySQL hostname */
define('DB_HOST', 'db');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org             secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to     have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         'fdsa;
define('SECURE_AUTH_KEY',  'fdsa);
define('LOGGED_IN_KEY',    'nlbjfdsaN');
define('NONCE_KEY',        'vkYWPmWfdsaTL<R2Pi=PV,Ox|');
define('AUTH_SALT',        'EkbHwfdsa');
define('SECURE_AUTH_SALT', '9!OnH2Ee:fdsag]f');
define('LOGGED_IN_SALT',   ')bfdsa.K(');
define('NONCE_SALT',       'Wj3fdsa');

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the Codex.
 *
 * @link https://codex.wordpress.org/Debugging_in_WordPress
 */
define('WP_DEBUG', false);

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
	define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

My relevant config

Here’s what I get when I visit the site:

The website is working, but misconfigured. These are the cause of your lack of styling in the browser:

This is because your Caddyfile has this rewrite:

rewrite {
        if {path} not_match ^\/wp-admin
        to {path} {path}/ /index.php?_url={uri}
}

But you don’t need to, because Wordpress’ default container runs Apache and handles this rewrite already, so you’re double rewriting. Try without this rewrite entirely.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.