mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-15 08:34:11 +03:00
Merge pull request #194 from Mibew/trusted_proxies
Add "trusted_proxy" option
This commit is contained in:
commit
6ea5f5af11
@ -77,6 +77,15 @@ default_locale: en
|
||||
# http://php.net/manual/en/timezones.php
|
||||
timezone: ""
|
||||
|
||||
# List of proxy's IP Mibew should trust. You should set this option if you use
|
||||
# Mibew with a load balancer or behind a proxy.
|
||||
trusted_proxies: []
|
||||
# Here is an example of what values this option can take:
|
||||
# trusted_proxies:
|
||||
# - 127.0.0.1
|
||||
# - ::1
|
||||
# - 10.0.0.0/8
|
||||
|
||||
# Plugins
|
||||
plugins: []
|
||||
|
||||
|
@ -59,6 +59,12 @@ function load_system_configs()
|
||||
$configs['plugins'] = array();
|
||||
}
|
||||
|
||||
// Trusted proxies section should exists too. The logic behind "empty" statement is
|
||||
// the same as above.
|
||||
if (empty($configs['trusted_proxies'])) {
|
||||
$configs['trusted_proxies'] = array();
|
||||
}
|
||||
|
||||
// Database section should exists too. Also it should have an appropriate structure.
|
||||
if (empty($configs['database'])) {
|
||||
$configs['database'] = array();
|
||||
|
@ -44,6 +44,10 @@ require_once(MIBEW_FS_ROOT . '/libs/common/request.php');
|
||||
require_once(MIBEW_FS_ROOT . '/libs/common/response.php');
|
||||
require_once(MIBEW_FS_ROOT . '/libs/common/string.php');
|
||||
|
||||
if (count($configs['trusted_proxies']) > 0) {
|
||||
\Symfony\Component\HttpFoundation\Request::setTrustedProxies($configs['trusted_proxies']);
|
||||
}
|
||||
|
||||
// We need to get some info from the request. Use symfony wrapper because it's
|
||||
// the simplest way.
|
||||
$tmp_request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
|
||||
|
Loading…
Reference in New Issue
Block a user