Skip to content

Nginx RTMP Hooks and HTTPS Redirect Issue

Daniel Neto edited this page Apr 4, 2026 · 1 revision

Problem

  • The on_publish, on_play, on_done and similar hooks from nginx-rtmp-module use only HTTP

  • They do not support HTTPS

  • If your server redirects HTTP → HTTPS:

    • All on_* hooks will fail
    • AVideo will not receive the events correctly

What breaks the hooks

  • ❌ Using https:// in on_* URLs
  • ❌ Automatic HTTP → HTTPS redirect
  • ❌ Any proxy/CDN forcing HTTPS
  • ❌ Domain that does not respond directly on HTTP

Expected behavior (working)

  • The hook must be called like:
http://your-server/plugin/Live/on_publish.php
  • And must return:
HTTP 200 OK
  • No redirect allowed

Broken behavior (common issue)

If this happens:

http://your-server/plugin/Live/on_publish.php
→ 301 redirect → https://your-server/...

Then:

  • nginx-rtmp cannot follow properly
  • Hook fails
  • Live streaming logic breaks

Recommendation (important)

Same server setup

  • If Nginx RTMP and AVideo are on the same server:
use http://127.0.0.1

Example:

on_publish http://127.0.0.1/plugin/Live/on_publish.php;
on_play    http://127.0.0.1/plugin/Live/on_play.php;
on_done    http://127.0.0.1/plugin/Live/on_done.php;
  • This avoids:

    • redirects
    • SSL issues
    • DNS problems

Mandatory requirement

  • The on_* URLs:

    • MUST be HTTP
    • MUST NOT redirect

If any redirect or HTTPS is involved:

  • ❌ It will not work
  • ❌ There is no workaround inside nginx-rtmp

Conclusion

  • nginx-rtmp hooks require direct HTTP access

  • HTTPS or redirects will break the integration

  • The safest approach is:

    • use 127.0.0.1 when possible
    • ensure zero redirects on these endpoints

Clone this wiki locally