From e65fa1bd94a4f19282864f63c92d21902ec77aa3 Mon Sep 17 00:00:00 2001 From: Stas Vartanyan <47596772+vaawebdev@users.noreply.github.com> Date: Wed, 27 Apr 2022 11:29:07 +0400 Subject: [PATCH] Support 5, 6, and 7 versions of symfony/yaml (#467) * symfony/yaml bump * Or constraint * orchestra/testbench phpunit integration ::getAnnotations() call fix * Deprecated Request::HEADER_X_FORWARDED_ALL usage --- composer.json | 4 ++-- src/Http/Controllers/SwaggerController.php | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 35d2ae5..007a9ff 100644 --- a/composer.json +++ b/composer.json @@ -23,13 +23,13 @@ "laravel/framework": "^9.0 || >=8.40.0 || ^7.0", "zircote/swagger-php": "^3.2 || ^4.0", "swagger-api/swagger-ui": "^3.0 || ^4.0", - "symfony/yaml": "^5.0", + "symfony/yaml": "^5.0 || ^6.0", "ext-json": "*" }, "require-dev": { "phpunit/phpunit": "^9.5", "mockery/mockery": "1.*", - "orchestra/testbench": "6.* || 5.*", + "orchestra/testbench": "7.* || ^6.15 || 5.*", "php-coveralls/php-coveralls": "^2.0" }, "autoload": { diff --git a/src/Http/Controllers/SwaggerController.php b/src/Http/Controllers/SwaggerController.php index 415d739..2cac00d 100644 --- a/src/Http/Controllers/SwaggerController.php +++ b/src/Http/Controllers/SwaggerController.php @@ -108,7 +108,14 @@ public function api(Request $request) if (! is_array($proxy)) { $proxy = [$proxy]; } - Request::setTrustedProxies($proxy, Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies( + $proxy, + 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 + ); } $urlToDocs = $this->generateDocumentationFileURL($documentation, $config);