yii2-debug icon indicating copy to clipboard operation
yii2-debug copied to clipboard

Allowed IP's bug

Open vkamelin opened this issue 3 years ago • 1 comments

What steps will reproduce the problem?

config:

    'bootstrap' => ['debug', 'gii'],
    'modules' => [
        'debug' => [
            'class' => 'yii\debug\Module',
            'allowedIPs' => ['*']
        ],
        'gii' => [
            'class' => 'yii\gii\Module',
        ]
    ],

What's expected?

Panel works

What do you get instead?

$debug = Yii::$app->getModule('debug');

$debug->allowedIPs returns:

array(2) {
  [0]=>
  string(9) "127.0.0.1"
  [1]=>
  string(3) "::1"
}

Panel doesn't works

Additional info

If manualy change allowedIPs in yii\debug\Module.php, it returns ['*'] and panel works

Q A
Yii version 2.0.41.1
PHP version 7.4.3
Operating system Ubuntu 20.04.2

vkamelin avatar May 12 '21 05:05 vkamelin

It looked like I had this problem earlier today, and but it turned out to be file permission problems for me. Hopefully you figured something out, but for anyone else having a problem like this and who find their way here, check if you are getting a 404 error in the dev tools of your web browser (which is what I had). If so, make sure the user/group permissions allow the server to write to the runtime/debug directory. I set the runtime/ directory to 777, made it such that it is owned by the http:http user/group, and deleted everything in it, allowing the server to recreate the directory structure it needed, and allowing the server to access said directories. I'm pretty sure I could get away with just user:http and 664, but as I'm not worried about security with this like I would for a production server, it works so why change it.

AlexOConnorHub avatar Mar 11 '22 18:03 AlexOConnorHub