From e7c5b2b0b07c031723d2858fe2ec2433c2327de4 Mon Sep 17 00:00:00 2001 From: Eduardo Santos Date: Fri, 13 Jun 2014 19:07:24 -0300 Subject: [PATCH] Mudanças para funcionar atrás do balanceador de carga --- .gitignore | 1 + app/config/config.yml | 26 +++++++++++++++++++++++--- app/config/config_prod.yml | 5 ++++- web/app.php | 2 ++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e1ca5d4..1adc0d3 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ web/downloads/ web/images/ web/js/ web/assetic/ +web/app.php # Ignora htaccess .htaccess diff --git a/app/config/config.yml b/app/config/config.yml index eade0e4..d5b4d76 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -14,8 +14,16 @@ framework: validation: { enable_annotations: true } templating: { engines: ['twig'] } #assets_version: SomeVersionScheme default_locale: "%locale%" - trusted_proxies: ~ - session: ~ +# trusted_proxies: ~ + session: + handler_id: session.handler.pdo + +parameters: + pdo.db_options: + db_table: session + db_id_col: session_id + db_data_col: session_value + db_time_col: session_time # Twig Configuration twig: @@ -181,4 +189,16 @@ services: cacic_demo.command.upgrade_command: class: Cacic\CommonBundle\Command\UpgradeCommand tags: - - { name: console.command } \ No newline at end of file + - { name: console.command } + pdo: + class: PDO + arguments: + - "pgsql:host=%database_host%;port=%database_port%;dbname=%database_name%" + - "%database_user%" + - "%database_password%" + calls: + - [setAttribute, [3, 2]] # \PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION + + session.handler.pdo: + class: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler + arguments: ["@pdo", "%pdo.db_options%"] diff --git a/app/config/config_prod.yml b/app/config/config_prod.yml index 060f76a..141a2e6 100644 --- a/app/config/config_prod.yml +++ b/app/config/config_prod.yml @@ -1,6 +1,9 @@ imports: - { resource: config.yml } +framework: + trusted_proxies: [10.0.0.0/8] + doctrine: orm: auto_mapping: true @@ -20,4 +23,4 @@ monolog: level: warning swiftmailer: - sender_address: www-data@localhost \ No newline at end of file + sender_address: www-data@localhost diff --git a/web/app.php b/web/app.php index cc3401d..03979ab 100755 --- a/web/app.php +++ b/web/app.php @@ -22,3 +22,5 @@ $request = Request::createFromGlobals(); $response = $kernel->handle($request); $response->send(); $kernel->terminate($request, $response); +// only trust proxy headers coming from this IP addresses +Request::setTrustedProxies(array('10.0.0.0/8')); -- libgit2 0.21.2