appstract / laravel-opcache

Laravel Package for OPcache
MIT License
1.34k stars 119 forks source link

IIS doesn't provide the variable SERVER_ADDR #36

Closed Jamiek94 closed 7 years ago

Jamiek94 commented 7 years ago

I'm using Windows IIS 10 web server to host my laravel application.

When I tried one of the commands (doesn't matter which one) I received a server error saying: "Undefined index: SERVER_ADDR".

IIS doesn't provide the "SERVER_ADDR" variable.

If you would like to make the package windows compatible you could use the variable "LOCAL_ADDR". This variable is only provided on IIS servers.

File: "appstract\laravel-opcache\src\Http\Middleware\Request.php" Line: 25

public function handle($request, Closure $next)
    {
        // LOCAL_ADDR
        if (! in_array($this->getRequestIp($request), [$_SERVER['SERVER_ADDR'], '127.0.0.1', '::1'])) {
            throw new HttpException(403, 'This action is unauthorized.');
        }

        return $next($request);
    }
ovanschie commented 7 years ago

Fixed in v1.2