Go for it!

モーターサイクルと自転車とキャンプの日々。

symfonyアプリケーションのアクセス元を制限する

自動生成されたエントリポイント(って言えばいいのか? アプリが起動するPHP)に書かれていたのでメモ。ここで制限かけられるのは楽かも。

[code lang=‘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.’); } [/code]

配列の中に許可するIPアドレスを書き並べていけばOK。

[ad#text_wide]