admin-ajax.php on WordPress Multisite with Proxy
-
We have a WordPress multisite that we need to be able to access with its usual domain, but also through a proxy domain (Azure proxy). I put some code into the wp-config file that fixes most issues with URLs, but it seems like setting WP_SITEURL dynamically isn’t working for calls to the ajaxurl admin-ajax.php in plugins.
Is it correct that the ajaxurl is dependent on a call to site_url() which is pulling it from the database and ignoring the WP_SITEURL settings in the config file? How can I overcome that?
Here are the changes in wp-config.php/** Sets up WordPress vars and included files. */
if (isset($_SERVER[‘HTTP_X_MS_PROXY’]) && ($_SERVER[‘HTTP_X_MS_PROXY’] == ‘AzureAD-Application-Proxy’)) {
$host = ‘proxifieddomain.net’; }
else {
$host = $_SERVER[‘HTTP_HOST’]; }$protocol = ((!empty($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] !== ‘off’) || (isset($_SERVER[‘SERVER_PORT’]) && $_SERVER[‘SERVER_PORT’]===443)) ? ‘https://’ : ‘https://’;
define(‘WP_SITEURL’, $protocol . $host);
define(‘WP_HOME’, $protocol . $host);I also tried to dynamically set the DOMAIN_CURRENT_SITE value for multisite but that didn’t fix it either.
- You must be logged in to reply to this topic.