Use directive code from other module inside my custom ngx_http_mycontrol_module
Zyrot System
zyrotnet at gmail.com
Wed Mar 12 15:04:24 UTC 2025
Hello everyone, first I want to say I already searched mailman.nginx.org
for a topic relating to my question but I cannot find it.
ngx_http_rewrite_module has directives rewrite, return, etc. I want to use
directives code from other module inside my module so can do code reuse
"DRY", for example create my own directive like:
server { # important to work in this Context
mycontrol * {
myrewrite ^(/download/.*)/media/(.*)\..*$ $1/mp3/$2.mp3 last;
# using the core ngx_http_rewrite_module.c
}
mycontrol * {
# optional using the original ngx_http_rewrite_module.c
rewrite ^(/download/.*)/media/(.*)\..*$ $1/mp3/$2.mp3 last;
}
}
So can avoid replicate the already functionality (I want to extend the
ngx_http_rewrite_module, and others modules in my module mycontrol with
more features). Any ideas ?
I just want to be sure for what route to go, maybe instead I should used
the PCRE library directly in ngx_http_mycontrol_module like does other
modules ?
Thanks for reading
Note repost in:
stackoverflow.com/questions/79503527/use-directive-code-from-other-module-inside-my-module-nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20250312/467782f7/attachment.htm>
More information about the nginx-devel
mailing list