• Resolved davmit2020

    (@davmit2020)


    Our site is setup in Azure. We are using Azure front door. So if our domain is website.com and azure front door URL is frontdoor.com when we enable the cache its creating the cache folders inside the “/wp-content/cache/wpo-cache” folder with the name as frontdoor.com instead of the actual domain website.com.

    This causes an error as the cache looks up for domain folder and never finds one.
    Anyway to override this value or give a custom value for creating these folders?

    Thanks much

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.

    @davmit2020 At the moment there’s no hook/filter to override the wp.o_current_url function.

    I’ll share this with our development team, If this is can be fixed in future release.

    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.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Azure Front door setup error’ is closed to new replies.