User Tools

Site Tools


URL Part Signature

This type of signature could be used in case of some set of files in one folder, e.g.:


Therefore you could generate signed URL for this part


and concatenate different file name without changing signature. Another case of using URL part signature : file names in one subfolder differ with some suffix , e.g.:


This part


could be used for generating signature.

Example of the script for signed URL generation

# link end of life , 3600 - lifetime in seconds                       
$expire = time() + 3600;        

# file in CDN  1/2/3_720p.mp4
$file_part1 = "1/2/3_"; 
$file_part2 = "720p.mp4";
$file_part1_len = length($file_part1);
$url = ",end=$expire,len=$file_part1_len/$file_part1";

# You can change speed and buffer setting in the URL,  by default settings are taken from account`s settings,
# or from domain`s settings
#$url = ",end=$expire,len=$file_part1_len/speed=300K/buffer=5.0/$file_part1";

$domain = '';    

$secret = 'qwerty'; # ask  CDN support about it 
$key = substr(base64_encode(md5("$secret$url", true)), 0, 22);
$key = str_replace('/', '-', $key); 
$fullurl = 'http://' . $domain . '/key=' . $key . $url$file_part2;

# You will get link like 
# $fullurl == ",end=1374068216,len=6/1/2/3_720p.mp4" 

You can specify list of IPs which will not be checked for URL sign ( 'keycheck_whitelist' setting ). Can be set via CDN support.

You can read here about regular URL signature: URL signature

en/feature_url_sign_part.txt · Last modified: 2020/08/05 16:53 by psv