symfonyアプリケーションのアクセス元を制限する
11月 7th, 2008 by
key
自動生成されたエントリポイント(って言えばいいのか? アプリが起動するPHP)に書かれていたのでメモ。ここで制限かけられるのは楽かも。
// this check prevents access to debug front conrollers that are deployed by accident to production servers.
// feel free to remove this, extend it or make something more sophisticated.
if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1')))
{
die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
配列の中に許可するIPアドレスを書き並べていけばOK。
