Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter davmit2020

    (@davmit2020)

    Adding below line in wp-config.php to override $_SERVER[‘HTTP_HOST’] worked for me.

    $_SERVER['HTTP_HOST'] = "yourdomain.com";

    Now I can see cache folders created with domain url instead of the Azure Frontdoor url.

    • This reply was modified 5 years, 2 months ago by davmit2020.
    Thread Starter davmit2020

    (@davmit2020)

    I found the code which may block this whenever this plugin is used with Azure Frontdoor.

    check the code in file-based-page-cache-functions.php file at line 581

    if (!function_exists('wpo_current_url')) :
    function wpo_current_url() {
    	// Note: We use <code>static $url</code> to save the first value we retrieve, as some plugins change $_SERVER later on in the process (e.g. Weglot).
    	// Otherwise this function would return a different URL at the begining and end of the cache process.
    	static $url = '';
    	if ('' != $url) return $url;
    	$http_host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
    	$url = rtrim('http' . ((isset($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'] || 1 == $_SERVER['HTTPS']) ||
    			isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO']) ? 's' : '' )
    		. '://' . $http_host.$_SERVER['REQUEST_URI'], '/');
    	return $url;
    }
    endif;

    The above code is using $_SERVER[‘HTTP_HOST’] which will always return Azure Front door URL instead of the site url.
    Not sure if there is something to override this.

Viewing 2 replies - 1 through 2 (of 2 total)