Symfony 2 app.php vs app_dev.php

I use the Symfony 2 php framework, which has several different usage environments: development, production, and testing. The front controller app.php accesses the production environment, and the front controller app_dev.php accesses the development environment. Can anyone familiar with Symfony advise what is the best way to limit the development environment for developers? I do not want the version of my web application to be available for viewing by users of my site, they should be limited to using the working environment.

+3
source share
1 answer

Well, from the standard version, standard distribution has an IP-based security check on top of the dev controller.

// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !in_array(@$_SERVER['REMOTE_ADDR'], array(
        '127.0.0.1',
        '::1',
    ))
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

, , . , Apache, HTTP- dev .

+10

All Articles