Nginx-rtmp-module: on_publish url does not support https callback it ?

Created on 12 Jan 2018  Â·  3Comments  Â·  Source: arut/nginx-rtmp-module

on_publish https://tinywan.com/arut/callback.php

MSG

nginx: [emerg] invalid port in url 

Most helpful comment

+1 have the same problem, any work around?

All 3 comments

+1 have the same problem, any work around?

I just encountered the same problem after I changed the publish url to be over https. anyone any ideas?

@aefox Hi! ,I solved it through the following ways

RTMP module

rtmp {
  ...
  on_publish  http://127.0.0.1:8334/rtmp_redirect_lua;
  ...
}

config host server

    server {
        listen 8334;
        server_name  127.0.0.1;
        resolver 8.8.8.8;
        location ~* /rtmp_redirect_lua {
             #lua_code_cache off;
             access_by_lua_file /usr/local/openresty/nginx/conf/lua/rtmp_auth_key.lua;
         }
    }

rtmp_auth_key.lua

    local httpc = http.new()
    local resp, err = httpc:request_uri("https://www.tinywan.com", {
        method = "GET",
        --path = "/Stream/luaHttpRequest?"..args_string,
        path = "/stream/privatePushCallbackUrl?"..args_string,
        headers = {
            ["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36"
        },
        ssl_verify = false   -- must
    })

    if not resp then
        LOG(ERR, "resty.http API request error :", err)
        return
    end

    if resp.status ~= ngx.HTTP_OK then
        LOG(ERR, "request error, status :", resp.status)
        return
    end

    if resp.status == ngx.HTTP_FORBIDDEN then
        LOG(ERR, "request error, status :", resp.status)
        return
    end

    if tostring(resp.body) ~= "200" then
        LOG(ERR,"Https APi is Fail return-value = "..resp.body)
        return
    end
    httpc:close()
    return 200
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ama-ableton picture ama-ableton  Â·  6Comments

Mattyzero picture Mattyzero  Â·  6Comments

WayneShao picture WayneShao  Â·  3Comments

UspenskyRuslan picture UspenskyRuslan  Â·  5Comments

marcoeg picture marcoeg  Â·  3Comments