diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-02-24 12:24:55 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-02-24 12:24:55 +0100 |
commit | 1c6eae90173b2b323a8e4633cda5f37eafa5a1d4 (patch) | |
tree | e7121f8edcb0d9d537e91d9ca20e947613bbba41 /tests/lib | |
parent | e08ebe87dcd748deecba52714cf2711095671475 (diff) | |
download | nextcloud-server-1c6eae90173b2b323a8e4633cda5f37eafa5a1d4.tar.gz nextcloud-server-1c6eae90173b2b323a8e4633cda5f37eafa5a1d4.zip |
Get the real protocol behind several proxies
X-Forwarded-Proto contains a list of protocols if ownCloud is behind multiple reverse proxies.
This is a revival of https://github.com/owncloud/core/pull/11157 using the new IRequest public API.
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/appframework/http/RequestTest.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/lib/appframework/http/RequestTest.php b/tests/lib/appframework/http/RequestTest.php index 3185a0093c4..282d13a3397 100644 --- a/tests/lib/appframework/http/RequestTest.php +++ b/tests/lib/appframework/http/RequestTest.php @@ -593,6 +593,27 @@ class RequestTest extends \Test\TestCase { $this->assertSame('http', $request->getServerProtocol()); } + public function testGetServerProtocolBehindLoadBalancers() { + $this->config + ->expects($this->once()) + ->method('getSystemValue') + ->with('overwriteprotocol') + ->will($this->returnValue('')); + + $request = new Request( + [ + 'server' => [ + 'HTTP_X_FORWARDED_PROTO' => 'https,http,http' + ], + ], + $this->secureRandom, + $this->config, + $this->stream + ); + + $this->assertSame('https', $request->getServerProtocol()); + } + /** * @dataProvider userAgentProvider * @param string $testAgent |