使用on_publish访问外部微服务时发生NGINX RTMP实时流式输入/输出错误

使用on_publish访问外部微服务时发生NGINX RTMP实时流式输入/输出错误,nginx,rtmp,live-streaming,Nginx,Rtmp,Live Streaming,Nginx.conf rtmp { server { listen 1935; chunk_size 4000; application stream { live on; #exec ffmpeg -i rtmp://localhost:1935/stream/$name -codec copy -f flv rtmp://$name-live-encoder/play;

Nginx.conf

rtmp {
    server {
        listen 1935;
        chunk_size 4000;
        application stream {
            live on;
            #exec ffmpeg -i rtmp://localhost:1935/stream/$name -codec copy -f flv rtmp://$name-live-encoder/play;
            on_publish http://<hostName>:<port>/auth/validate;
            exec ffmpeg -re -i rtmp://localhost:1935/stream/$name -codec copy -bsf:v h264_mp4toannexb -f mpegts udp://live-${name}-udp-encoder-service.rtmp-live-test:3555;
        }
    }
}
rtmp{
服务器{
听着,1935年;
块大小为4000;
应用程序流{
靠...过活
#执行ffmpeg-irtmp://localhost:1935/stream/$name-编解码器副本-f flv rtmp://$name实时编码器/播放;
发布时http://:/auth/validate;
执行ffmpeg-re-irtmp://localhost:1935/stream/$name-编解码器副本-bsf:v h264_mp4toannexb-f mpegtsudp://live-${name}-udp编码器服务。rtmp实时测试:3555;
}
}
}
传入RTMP流:rtmp://host:port/stream/ksptv?secret=234rfghi4e

微服务:http://HOSTNAME/auth/validate?name=ksptv&secret=234rfghi4e ==>如果密钥与通道匹配,则返回201;如果不匹配,则返回403

当RTMP流化时,流退出,并出现I/O错误 输入rtmp流日志

rtmp://rtmpHOST/stream/qptv-ind1?secret=hYn4cyWW56WdAhLussHkUw==: 输入/输出错误[AVIOContext@0x2291f00]统计信息:199663字节 阅读,0寻找

按以下方式使用时,on_发布未处理或点击微服务

        on_publish http://<hostName>:<port>/auth/validate;
关于发布http://:/auth/validate;
但是,当我使用localhost/auth实现on_publish并在nginx.conf中使用location/auth{return 201}定义服务器块时,rtmp流传输是成功的


您能帮助我理解为什么on_publish不能与外部url/api一起工作。

您解决过这个问题吗?我也有类似的问题;尽管我怀疑这与我的kubernetes dns有关,因为我没有看到我的身份验证服务被攻击——尽管我确实在日志中看到了“on_publish”的描述。你有解决过这个问题吗?我也有类似的问题;尽管我怀疑这与我的kubernetes dns有关,因为我没有看到我的身份验证服务被攻击——尽管我确实在日志中看到了“on_publish”的描述。