Azure proxy – admin-ajax.php loads at original site_url
-
So, we’re having to load our wordpress (multi-site) two ways. If people are on the intranet they load it at its regular URL. If they’re coming through externally they’re using an Azure proxy.
I added this to wp-config.php and it works for everything except ajax calls, which keep getting called over the site_url which is the database (internal url, not proxified) for proxy users.
/** Sets up WordPress vars and included files. */ if (isset($_SERVER['HTTP_X_MS_PROXY']) && ($_SERVER['HTTP_X_MS_PROXY'] == 'AzureAD-Application-Proxy')) { $host = 'ourwebsite-external.msappproxy.net'; } else { $host = $_SERVER['HTTP_HOST']; } //$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); require_once(ABSPATH . 'wp-settings.php');
How can I get the site to set the ajaxurl so that it uses the proxy address for external users and the regular site address for our intranet users?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Azure proxy – admin-ajax.php loads at original site_url’ is closed to new replies.