<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hello everyone, first I want to say I already searched <a href="http://mailman.nginx.org">mailman.nginx.org</a> for a topic relating to my question but I cannot find it.</div><div><br></div><div>
<p>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:</p>
<pre><code>    server {  <span># important to work in this Context</span>

     mycontrol * {
        myrewrite ^(/download/.*)/media/(.*)\..*$ $<span>1</span>/mp3/$<span>2.</span>mp3 last; <span># using the core ngx_http_rewrite_module.c</span>

     }
     mycontrol * {
        <span># optional  using the original ngx_http_rewrite_module.c</span>
        rewrite  ^(/download/.*)/media/(.*)\..*$ $<span>1</span>/mp3/$<span>2.</span>mp3 last; 

     }
}
</code></pre>
<p>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 ?</p><p>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 ?</p><p></p>
<p>Thanks for reading</p><p>
Note repost in: <a href="http://stackoverflow.com/questions/79503527/use-directive-code-from-other-module-inside-my-module-nginx">stackoverflow.com/questions/79503527/use-directive-code-from-other-module-inside-my-module-nginx</a>

<br></p>

<br></div></div>
</div>
</div>