Answer the question
In order to leave comments, you need to log in
Is it possible to resolve the nginx error "alias" cannot be used in location "/hls/" where URI was rewritten?
Installed kaltura nginx-vod-module, which gives mp4 via hls.
hls is available at: domain/hls/output.mp4/index.m3u8
I thought to use nginx secure link to protect against hotlink:
nginx config
location /tv/ {
rewrite /tv/([a-zA-Z0-9_\-]*)/([0-9]*)/(.*)/(.*)$ /hls/$3/$4?secl=$1§=$2;
}
location ^~ /hls/ {
alias domain/flvideo/;
secure_link $arg_secl,$arg_sect;
secure_link_md5 mysecretword$uri$arg_sect$remote_addr;
rewrite ^/hls/(.*)/(.*)$ /hls/$1/$2 break;
vod hls;
vod_segment_duration 10000;
vod_align_segments_to_key_frames on;
vod_manifest_segment_durations_mode accurate;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
add_header Access-Control-Allow-Origin '*';
location ~ \.index.m3u8$ {
if ($secure_link = "") { return 403; }
if ($secure_link = "0") { return 404; }
}
}
Answer the question
In order to leave comments, you need to log in
I didn’t really go into it, but ... didn’t I try to make rewrite higher in the server level? Now you have some kind of logical loop - the request goes to location, there it has an alias, and then a rewrite comes and spoils everything. Well, the meaning of this rewrite is still incomprehensible. Take the url /hls/ololo/trololo and rewrite it to /hls/ololo/trololo ? Is he needed at all?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question