Skip to content

Commit

Permalink
Merge pull request #4 from josiasmontag/laravel-9
Browse files Browse the repository at this point in the history
Laravel 9
  • Loading branch information
jdavidbakr authored Feb 23, 2022
2 parents 259a294 + 221613a commit 7a2fea0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"role": "Developer"
}],
"require": {
"illuminate/support": "5.6.*|5.7.*|5.8.*|6.*|7.*|8.*",
"illuminate/support": "5.6.*|5.7.*|5.8.*|6.*|7.*|8.*|^9.0",
"guzzlehttp/guzzle": "^6.3|^7.0"
},
"require-dev": {
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~7.0|~8.0",
"orchestra/testbench": "~3.0|~4.0|~5.0|6.x-dev"
"phpunit/phpunit": "~7.0|~8.0|^9.0",
"orchestra/testbench": "~3.0|~4.0|~5.0|~6.0|^7.0"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 5 additions & 1 deletion config/cloudfront-proxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@
/**
* Headers defined in the TrustProxies class
*/
'trust-proxies-headers' => Request::HEADER_X_FORWARDED_ALL,
'trust-proxies-headers' => Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB,
];
12 changes: 10 additions & 2 deletions tests/CloudfrontProxiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ class CloudfrontProxiesTest extends BaseTestCase
protected function getEnvironmentSetUp($app)
{
$app['config']->set('cloudfront-proxies.ip-range-data-url', 'https://ip-ranges.amazonaws.com/ip-ranges.json');
$app['config']->set('cloudfront-proxies.trust-proxies-headers', Request::HEADER_X_FORWARDED_ALL);
$app['config']->set('cloudfront-proxies.trust-proxies-headers', Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB);
}

/**
Expand Down Expand Up @@ -73,7 +77,11 @@ public function it_retains_existing_trusted_ip_addresses()
], // server
null // content
);
$request->setTrustedProxies(['123.45.67/8'], Request::HEADER_X_FORWARDED_ALL);
$request->setTrustedProxies(['123.45.67/8'], Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB);
$middleware = new CloudfrontProxies;
$mock = Mockery::mock(Guzzle::class);
$response = Mockery::mock(ResponseInterface::class);
Expand Down

0 comments on commit 7a2fea0

Please sign in to comment.