View Issue Details

IDProjectCategoryView StatusLast Update
0005685OXID eShop (all versions)4.08. Cachepublic2014-09-10 10:20
Reporterarvydas_vapsva 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target Version4.7.14 / 5.0.14Fixed in Version4.9.0_5.2.0_RC1 
Summary0005685: Varnish issues on balanced system
DescriptionWe had load balancer/varnish server and two Apache web servers behind. HIT rate was very low, until we found out, that $_SERVER["HTTP_HOST"] parameter was filled in with balancer IP address, not with domain name (domain name was actually written into $_SERVER['HTTP_X_FORWARDED_HOST']), thus oxUtilsServer::isCurrentUrl( $sURL ) was always returning false, causing ReverseProxy headers to "no-cache".

Our hack was to append config.inc.php with $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
TagsNo tags attached.
ThemeAll
BrowserAll
PHP Versionany
Database Versionany

Activities

saulius.stasiukaitis

2014-03-12 09:49

reporter   ~0009636

Same problem exist without Varnish. $this->getServerVar( 'HTTP_HOST' ) returned IP address not domain address. This way method isCurrentUrl() decided that URL is not same and SID was added to all links.

saulius.stasiukaitis

2014-08-27 15:52

reporter   ~0010100

Additional logic to check both cases added:
    public function isCurrentUrl($sURL)
    {
        // Missing protocol, cannot proceed, assuming true.
        if (!$sURL || (strpos($sURL, "http") !== 0)) {
            return true;
        }

        $sServerHost = $this->getServerVar('HTTP_HOST');
        $blIsCurrentUrl = $this->_isCurrentUrl($sURL, $sServerHost);
        if (!$blIsCurrentUrl) {
            $sServerHost = $this->getServerVar('HTTP_X_FORWARDED_HOST');
            if ($sServerHost) {
                $blIsCurrentUrl = $this->_isCurrentUrl($sURL, $sServerHost);
            }
        }

        return $blIsCurrentUrl;
    }

saulius.stasiukaitis

2014-08-27 15:53

reporter   ~0010101

oxUtilsUrl::getCurrentUrl still relies only on HTTP_HOST.
HTTP_X_FORWARDED_HOST is too much unreliable.