kaltura / nginx-vod-module

NGINX-based MP4 Repackager
GNU Affero General Public License v3.0
1.99k stars 439 forks source link

when i use a module in rewrite phase the http status is 404 #354

Closed MonkeyMajik closed 8 years ago

MonkeyMajik commented 8 years ago

Hello when i use a module in rewrite phase the http status is 404

like: location { the first module in the REWRITE_PHASE; the second module is vod_module;

}

i post a request was encrypted: GET /hlsurl/bGg.qMXipDx3BQ9J60Bs8vDENtHkw12Dnfg6SV8vjXk then a module in rewrite phase decrypt the url: open() "/usr/local/nginx/html/hlsweb/aa.mp4/index.m3u8" failed\ (20: Not a directory), client: 192.168.190.31, server: 192.168.192.101, request: "GET /hlsurl/bGg.qMX/ipDx3BQ9J60Bs8vDENtHkw12Dnfg6SV8vjXk HTTP/1.0", host: "192.168.192.101"

so how can i solve the problem?

erankor commented 8 years ago

can you paste the full config ?

MonkeyMajik commented 8 years ago

the post is: /hlsurl/bGg.qMXipDx3BQ9J60Bs8vDENtHkw12Dnfg6SV8vjXk_ then des decode the post: /hlsweb/aa.mp4/index.m3u8

des_key is my Third party suppliers in NGX_HTTP_REWRITE_PHASE

the error log show:open() "/usr/local/nginx/html/hlsweb/aa.mp4/index.m3u8" failed\ (20: Not a directory), client: 192.168.190.31, server: 192.168.192.101, request: "GET /hlsurl/bGg.qMX/ipDx3BQ9J60Bs8vDENtHkw12Dnfg6SV8vjXk_ HTTP/1.0", host: "192.168.192.101"

location /hlsurl{
     des_key "xxx"       
    }

location /hlsweb{

     vod hls;
     vod_mode local;

     vod_hls_absolute_index_urls off;                       

     vod_secret_key "secet-$vod_filepath";
             if ($request ~* (.*mp4)/(.*)) {
                     set $request_needed_1 $1;
                 }
      if ( $request_needed_1 ~* GET(.?)(.*)) {
                     set $request_needed $2;
                 }

      vod_hls_encryption_method aes-128;
      vod_hls_encryption_key_uri "http://192.168.190.31/hlsflash.php?path=$request_needed";

      vod_segment_duration 16000;

      gzip on;
          gzip_types application/vnd.apple.mpegurl;

          expires -1;
          add_header Last-Modified "Sun, 19 Nov 2000 08:52:00 GMT";
}
erankor commented 8 years ago

I'm sorry, but I'm not familiar with this module, and googling for it didn't seem to produce any relevant results, is it even open source ? If your goal is to encrypt the playback URL, you can use this module that we developed - https://github.com/kaltura/nginx-secure-token-module There's a sample config for URI encryption here - https://github.com/kaltura/nginx-secure-token-module#uri-encryption Our module not only encrypts the manifest URL, but the segment URLs as well - it edits the manifest response in order to encrypt any URLs included in it. This works for both HLS and DASH (but not HDS / MSS)

MonkeyMajik commented 8 years ago

des_key is a module i writed it's like when i post a url encrypted by des then the nginx service receive the encrypted url , the module will decrypted the post by des

well the moudle in NGX_HTTP_REWRITE_PHASE

erankor commented 8 years ago

From the error you pasted I think you are not even hitting the nginx-vod location, you probably hit the default / location. All log messages printed by this module are prefixed by the function name, so unless you didn't paste the full line, the log message was written by builtin nginx code.

MonkeyMajik commented 8 years ago

Ok i know thanks