Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on_publish, connection refuses no matter what I put in it. #1743

Open
JohnB17 opened this issue Nov 19, 2023 · 1 comment
Open

on_publish, connection refuses no matter what I put in it. #1743

JohnB17 opened this issue Nov 19, 2023 · 1 comment

Comments

@JohnB17
Copy link

JohnB17 commented Nov 19, 2023

I am trying to use on_publish to verify the stream key. If I forgot to provide something, go right ahead and ask.

I can curl from the host (of the server) and it works fine.
deny publish 10.49.197.1; is there so I can allow all local IPs and block the router, only local traffic is allowed.

RTMP config in nginx.conf:

rtmp {
  server {
    listen 1935;
    chunk_size 4096;
    allow publish 10.49.197.0/24;
    deny publish 10.49.197.1;
    deny publish all;

    application live {
      live on;
      record off;

      on_publish http://localhost:8080/verify;

      # Twitch - Better Platform
      #push rtmp://live.twitch.tv/app/[REDACTED];

      # YouTube - Slower than Twitch
      #push rtmp://a.rtmp.youtube.com/live2/[REDACTED];
    }
  }
}

sites-enabled/localhost:

server {
    listen 127.0.0.1:8080;
    server_name localhost;

    if ($request_method !~ ^(GET|HEAD)$) { return 403; }

    location /verify {
        allow all;
        expires off;

        set $livepass 0;
        if ($arg_livekey = "[My Nginx Stream Key]") { set $livepass 1; }
        if ($livepass = 1) { return 200; }

        return 401;
    }

}

access.log:

10.49.197.54 [19/Nov/2023:00:54:46 +0000] PUBLISH "live" "[My Nginx Stream Key]" "" - 392 292 "" "FMLE/3.0 (compatible; FMSc/1.0)" (0s)

10.49.197.54 is my PC's local IP, I am testing by broadcasting from OBS on my PC.

error.log:

2023/11/19 00:54:46 [error] 11141#11141: recv() failed (111: Connection refused)
@WhiskeyDeltaX
Copy link

It took me probably an hour to track down, but after having a similar problem, it seems like you can't on_publish with a port. Adding a location / proxy_pass to the http { server } then passing to http://localhost/proxyed worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants