Skip to content

Instantly share code, notes, and snippets.

@eveyrat
Created July 12, 2018 10:30
Show Gist options
  • Save eveyrat/cff3b71b514bcd237f05a9627f31cb54 to your computer and use it in GitHub Desktop.
Save eveyrat/cff3b71b514bcd237f05a9627f31cb54 to your computer and use it in GitHub Desktop.
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
/** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../app/autoload.php';
Debug::enable();
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
// AWS settings http://symfony.com/doc/2.8/request/load_balancer_reverse_proxy.html
Request::setTrustedProxies([
'127.0.0.1',
$request->server->get('REMOTE_ADDR'),
]);
Request::setTrustedHeaderName(Request::HEADER_FORWARDED, null);
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment