Signature is not valid
antonkomarev opened this issue · 2 comments
Laravel 5.1.7
League \ Glide \ Http \ SignatureException
Signature is not valid.
Can't make it work :'( But it works well without secure URL.
laravel-glide
published and hasn't been changed (using default). Image new.jpg
placed in folder ./storage/images
and folder is writable.
./storage/glide/cache
is writable too. Temporary files directory is writable.
In template I'm just trying to call:
<img src="{{ GlideImage::load('new.jpg') }}">
What could it be?
I found difference of signatures in url building and verification.
public function generateSignature($path, array $params)
receiving empty params array from urlBuilder
but validation of signatures bypassing params array with "r" => "img/new.jpg"
value to it.
All start to work with this hack:
public function generateSignature($path, array $params)
{
unset($params['s']);
unset($params['r']);
ksort($params);
return md5($this->signKey.':'.$path.'?'.http_build_query($params));
}
The problem was hidden in my nginx rewrite rules:
location / {
if (!-e $request_filename) {
rewrite ^/(.*) /index.php?r=$1 last;
}
}
Changed to:
location / {
try_files $uri $uri/ /index.php?$query_string;
}