Commit e7c5b2b0b07c031723d2858fe2ec2433c2327de4
1 parent
2a2992fa
Exists in
master
and in
1 other branch
Mudanças para funcionar atrás do balanceador de carga
Showing
4 changed files
with
30 additions
and
4 deletions
Show diff stats
.gitignore
app/config/config.yml
| ... | ... | @@ -14,8 +14,16 @@ framework: |
| 14 | 14 | validation: { enable_annotations: true } |
| 15 | 15 | templating: { engines: ['twig'] } #assets_version: SomeVersionScheme |
| 16 | 16 | default_locale: "%locale%" |
| 17 | - trusted_proxies: ~ | |
| 18 | - session: ~ | |
| 17 | +# trusted_proxies: ~ | |
| 18 | + session: | |
| 19 | + handler_id: session.handler.pdo | |
| 20 | + | |
| 21 | +parameters: | |
| 22 | + pdo.db_options: | |
| 23 | + db_table: session | |
| 24 | + db_id_col: session_id | |
| 25 | + db_data_col: session_value | |
| 26 | + db_time_col: session_time | |
| 19 | 27 | |
| 20 | 28 | # Twig Configuration |
| 21 | 29 | twig: |
| ... | ... | @@ -181,4 +189,16 @@ services: |
| 181 | 189 | cacic_demo.command.upgrade_command: |
| 182 | 190 | class: Cacic\CommonBundle\Command\UpgradeCommand |
| 183 | 191 | tags: |
| 184 | - - { name: console.command } | |
| 185 | 192 | \ No newline at end of file |
| 193 | + - { name: console.command } | |
| 194 | + pdo: | |
| 195 | + class: PDO | |
| 196 | + arguments: | |
| 197 | + - "pgsql:host=%database_host%;port=%database_port%;dbname=%database_name%" | |
| 198 | + - "%database_user%" | |
| 199 | + - "%database_password%" | |
| 200 | + calls: | |
| 201 | + - [setAttribute, [3, 2]] # \PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION | |
| 202 | + | |
| 203 | + session.handler.pdo: | |
| 204 | + class: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler | |
| 205 | + arguments: ["@pdo", "%pdo.db_options%"] | ... | ... |
app/config/config_prod.yml
| 1 | 1 | imports: |
| 2 | 2 | - { resource: config.yml } |
| 3 | 3 | |
| 4 | +framework: | |
| 5 | + trusted_proxies: [10.0.0.0/8] | |
| 6 | + | |
| 4 | 7 | doctrine: |
| 5 | 8 | orm: |
| 6 | 9 | auto_mapping: true |
| ... | ... | @@ -20,4 +23,4 @@ monolog: |
| 20 | 23 | level: warning |
| 21 | 24 | |
| 22 | 25 | swiftmailer: |
| 23 | - sender_address: www-data@localhost | |
| 24 | 26 | \ No newline at end of file |
| 27 | + sender_address: www-data@localhost | ... | ... |
web/app.php
| ... | ... | @@ -22,3 +22,5 @@ $request = Request::createFromGlobals(); |
| 22 | 22 | $response = $kernel->handle($request); |
| 23 | 23 | $response->send(); |
| 24 | 24 | $kernel->terminate($request, $response); |
| 25 | +// only trust proxy headers coming from this IP addresses | |
| 26 | +Request::setTrustedProxies(array('10.0.0.0/8')); | ... | ... |