openresty / set-misc-nginx-module

Various set_xxx directives added to nginx's rewrite module (md5/sha1, sql/json quoting, and many more)
http://wiki.nginx.org/NginxHttpSetMiscModule
388 stars 102 forks source link

Using set_* in RTMP application context #39

Closed pawel-tomkiel closed 6 years ago

pawel-tomkiel commented 6 years ago

Hey,

Thanks for your work, this module is awesome :)

I'm trying to build custom RTMP server with addition of nginx RTMP mod. Everything works fine, but I'd sent some additional parameters to my app. Everything must be in query string, so I'm afraid of special chars - so i encode them in base64. And here comes set_decode_base64 :)

When I'm trying to use it in context of application I get:

nginx: [emerg] "set_decode_base64" directive is not allowed here

Well, that's nothing wrong. It goes well with the specs.

So here's my question. Is there any possibility to somehow extend context of this function to also work in application? Minimum example below:

http {
    ...
}
rtmp {  
        server {
                ...
                application live {
                       ...
                       set_decode_base64 $arg_encoded_base64;
                }
        }
}
agentzh commented 6 years ago

@neonkowy This is an http module and its config directives can only be used inside the http {} block in your nginx.conf. You'll need a ngx_rtmp_set_misc_module for your purposes it seems. This is the ngx_http_set_misc_module in its full name.

pawel-tomkiel commented 6 years ago

Thanks @agentzh - that seems to be idea. If I start such project, I'll let you know ;)