-
Notifications
You must be signed in to change notification settings - Fork 23.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
864a829
commit e23a1d2
Showing
6 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use Illuminate\Http\Request; | ||
use Fideloper\Proxy\TrustProxies as Middleware; | ||
|
||
class TrustProxies extends Middleware | ||
{ | ||
/** | ||
* The trusted proxies for the application. | ||
* | ||
* @var array | ||
*/ | ||
protected $proxies; | ||
|
||
/** | ||
* The proxy header mappings. | ||
* | ||
* @var array | ||
*/ | ||
protected $headers = [ | ||
Request::HEADER_FORWARDED => 'FORWARDED', | ||
Request::HEADER_CLIENT_IP => 'X_FORWARDED_FOR', | ||
Request::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST', | ||
Request::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT', | ||
Request::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO', | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e23a1d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I have already used 'fideloper/proxy' in my project before this commit, I have added 'Fideloper\Proxy\TrustedProxyServiceProvider::class' in providers array of config/app.php. Just keep it? should you also need to include its service provider?
also "config/trustedproxy.php"
e23a1d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tai1030 Since the proxy package supports auto discovery you can remove that from Providers array. You can also remove the config since it will now use the Laravel Middleware file. https://laravel.com/docs/5.5/requests#configuring-trusted-proxies