refer_publish doesn't seem to be working
Laizhongsheng opened this issue · comments
Hi Winlin,
I am using the restriction of "refer_publish" for testing in a local area network, but it seems that it is not working.
The configuration is as follows: IP is 10.10.10.100, and there is a machine T1 for internal streaming, using FMLE for streaming.
vhost __defaultVhost__ {
refer_publish 10.10.10.100;
}
In different versions of SRS, the phenomenon is slightly different:
-
In the stable version SRS-CentOS6-x86_64-2.0.223.zip, when I change the IP address of T1 to 10.10.10.100 or 10.10.10.99, reconnect and start streaming, everything works fine without restricting the client.
-
If using source code compilation, git clone https://github.com/ossrs/srs,
A. Changing the IP address of T1 to 10.10.10.100 allows streaming.
B. Disconnecting the stream and changing the IP address of T1 to 10.10.10.99 results in failure to connect (displaying connection failed).
C. Changing the IP address of T1 back to 10.10.10.100 also results in failure to stream, displaying connection failed.
What went wrong?
Thank you.
TRANS_BY_GPT3
The source code is SRS3. You need to checkout the 2.0release branch. Can you please tell me how to use Git with Baidu? I will take another look at the SRS2 issue.
TRANS_BY_GPT3
SRS2 is working.
[2017-01-11 09:39:23.322][trace][76230][107] connect app, tcUrl=rtmp://127.0.0.1:1935/live, pageUrl=, swfUrl=, schema=rtmp, vhost=__defaultVhost__, port=1935, app=live, args=null
[2017-01-11 09:39:23.323][trace][76230][107] client identified, type=fmle-publish, stream_name=livestream, duration=-1.00
[2017-01-11 09:39:23.346][trace][76230][107] source url=/live/livestream, ip=127.0.0.1, cache=1, is_edge=0, source_id=-1[-1]
[2017-01-11 09:39:23.346][error][76230][107][35] check refer failed. ret=2015(Resource temporarily unavailable)
[2017-01-11 09:39:23.346][error][76230][107][35] check publish_refer failed. ret=2015(Resource temporarily unavailable)
[2017-01-11 09:39:23.346][error][76230][107][35] stream service cycle failed. ret=2015(Resource temporarily unavailable)
Configuration:
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
}
vhost __defaultVhost__ {
refer_publish winlin.cn;
}
I am using FFMPEG for streaming.
ffmpeg -re -i doc/source.200kbps.768x320.flv -c copy -f flv -y rtmp://127.0.0.1/live/livestream
The refer for FMLE streaming is also empty, just like FFMPEG. You can give it a try.
BTW: There is an issue with the configuration parsing of SRS3, I will fix it.
TRANS_BY_GPT3
This 'refer' restriction is limited to PageUrl, not IP. If you want to restrict IP, you need to use security configuration.
TRANS_BY_GPT3
In the log, I saw that the refer was empty. In version 3.0, it can indeed be restricted sometimes, but sometimes it doesn't work. I will verify it carefully again.
I couldn't find the configuration for security in the wiki.
TRANS_BY_GPT3
I found the configuration in the conf directory, the Security configuration, and it is indeed useful.
TRANS_BY_GPT3