There is a possibility to remove the error nginx "alias" cannot be used in location "/hls/" where URI was rewritten?

Kaltura installed nginx-vod-module which gives mp4 for hls.
hls is available at: domain/hls/output.mp4/index.m3u8
to protect from hotlinking thought to use the nginx secure link:

the nginx configuration

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; }
}
}

server error 500 "alias" cannot be used in location "/hls/" where URI was rewritten
June 7th 19 at 14:31
2 answers
June 7th 19 at 14:33
Strongly did not penetrate, but... not trying to make the rewrite a higher level in the server? Now you have some sort of logical loop is obtained, the request goes to the location where he got the alias, and then comes to. htaccess and all the spoils. Well, even a little strange meaning of this rewrite. Take the url /hls/ololo/trololo and rewrite it to /hls/ololo/trololo ? Do we need it?
June 7th 19 at 14:35
Thanks, the rewrite is really unnecessary.

Find more questions by tags Nginx