This repository has been archived by the owner on Oct 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a code snippet to allow dockerized applications run in dev.
- Loading branch information
Showing
2 changed files
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
// The following snippet allows app_dev.php for dockerized applications. | ||
// You need to replace your actual condition in /your/project/web/app_dev.php | ||
|
||
$dockerized = (bool) strstr($_SERVER['REMOTE_ADDR'], '172.'); | ||
|
||
if (isset($_SERVER['HTTP_CLIENT_IP']) | ||
|| isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !$dockerized | ||
|| !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) && !$dockerized | ||
) { | ||
header('HTTP/1.0 403 Forbidden'); | ||
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); | ||
} |