Answer the question
In order to leave comments, you need to log in
http_secure_link not working. What is the reason?
I'm trying to set up http_secure_link. The most simplified test:
location ~ \.mp4$ {
secure_link $arg_md5,$arg_expires;
secure_link_md5 "test";
if ($secure_link = "") { return 403; }
if ($secure_link = "0") { return 410; }
mp4;
mp4_buffer_size 1m;
mp4_max_buffer_size 5m;
}
function buildSecureLink($url)
{
$ttl = 10000;
$expires = time() + $ttl;
$md5 = md5("test", true);
$md5 = base64_encode($md5);
$md5 = strtr($md5, '+/', '-_');
$md5 = str_replace('=', '', $md5);
if(strpos($url, '?') !== false)
{
return $url . '&md5=' . $md5 . '&expires=' . $expires;
}
return $url . '?md5=' . $md5 . '&expires=' . $expires;
}
echo -n 'test' | openssl md5 -binary | openssl base64 | tr +/ -_ | tr -d =
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question