You are here

public function AuthcacheVarnishTestDefaultValidation::testRejectIfReverseProxyOff in Authenticated User Page Caching (Authcache) 7.2

Request is not comming through varnish if reverse_proxy variable is off.

File

modules/authcache_varnish/authcache_varnish.test, line 437
Test cases for authcache_varnish module.

Class

AuthcacheVarnishTestDefaultValidation
Unit tests for authcache_varnish_request_validate().

Code

public function testRejectIfReverseProxyOff() {
  $this
    ->variableSet('authcache_varnish_header', FALSE);
  $this
    ->variableSet('reverse_proxy', 0);
  $this
    ->variableSet('reverse_proxy_addresses', array(
    $this->proxyIp,
    $this->proxy2Ip,
  ));
  $_SERVER['HTTP_X_FORWARDED_FOR'] = "";
  $_SERVER['REMOTE_ADDR'] = $this->proxyIp;
  $this
    ->assertIdentical(FALSE, authcache_varnish_request_validate(), 'Reject request when reverse_proxy variable is off.');
  $_SERVER['REMOTE_ADDR'] = $this->proxy2Ip;
  $this
    ->assertIdentical(FALSE, authcache_varnish_request_validate(), 'Reject request when reverse_proxy variable is off.');
  $_SERVER['REMOTE_ADDR'] = $this->untrustedIp;
  $this
    ->assertIdentical(FALSE, authcache_varnish_request_validate(), 'Reject request when reverse_proxy variable is off.');
}