<div dir="ltr"><div class="gmail_quote" style="font-size:12.8px"><div dir="ltr">Hi All,<br><div><br></div><div><br></div><div>I have been working on developing an nginx module for one of my c++ web framework and in the process have also read a lot of nginx blogs to understand and come up with an nginx module of my own for my framework. I had a small query related to serving static files within a module handler.</div><div><br></div><div>So the query is, I have the below mentioned nginx configuration,</div><div><br></div><div><div>location ~ ^/(.+?)(/.*)?$ {</div><div>            ffeadcpp_path /home/vagrant/ffead-cpp/ffead-<wbr>cpp-2.0-bin/;</div><div>}</div><div><br></div><div>my framework web root is</div><div>/home/vagrant/ffead-cpp/ffead-<wbr>cpp-2.0-bin/web<br></div><div><br></div><div>It has multiple sites/context-roots within</div><div>/home/vagrant/ffead-cpp/ffead-<wbr>cpp-2.0-bin/web/default<br></div><div>/home/vagrant/ffead-cpp/ffead-<wbr>cpp-2.0-bin/web/markers<br></div><div>/home/vagrant/ffead-cpp/ffead-<wbr>cpp-2.0-bin/web/oauthApp<br></div><div>/home/vagrant/ffead-cpp/ffead-<wbr>cpp-2.0-bin/web/flexApp<br></div><div>/home/vagrant/ffead-cpp/ffead-<wbr>cpp-2.0-bin/web/te-benchmark<br></div><div><br></div><div>I want all requests to be handled by my custom module, within the module I handle all roots and also separate dynamic requests from static requests and handle all dynamic requests using my framework logic.</div><div><br></div><div>every site/folder/context has static files within the public folder, for eg,</div><div>/home/vagrant/ffead-cpp/ffead-<wbr>cpp-2.0-bin/web/default/public<br></div><div><br></div><div>I have reached a point and written a module which handles dynamic requests and serves them successfully but now I want nginx to handle static file processing instead of doing it myself. Is there a way to just change the request uri with an actual file location in this case to,</div><div>/home/vagrant/ffead-cpp/ffead-<wbr>cpp-2.0-bin/web/default/public<wbr>/index.html whenever a request for a static files arises according to the context root, In my module I separate the dynamic and static requests.<br></div><div>Right now i'm returning NGX_DONE from my static file handling block, I have even tried NGX_DECLINED but to no avail.</div><div><br></div><div><br></div><div>So in my module, I do,</div><div><br></div><div>if(not static file)</div></div></div></div><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_quote"><div dir="ltr">process it using my framework</div></div></blockquote><div class="gmail_quote" style="font-size:12.8px"><div dir="ltr">else</div></div><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_quote"><div dir="ltr">?? -- let nginx handle the static request, change the uri to add the ffeadcpp_path path prefix, along with the public suffix and the context root, signal nginx that this static request needs to be handled by nginx itself</div></div></blockquote><div class="gmail_quote" style="font-size:12.8px"><div dir="ltr"><div><br></div><div>The source code for the module is located at <a href="https://github.com/sumeetchhetri/ffead-cpp/blob/master/modules/nginx_mod_ffeadcpp/ngx_http_ffeadcpp_module.cpp" target="_blank">https://github.com/<wbr>sumeetchhetri/ffead-cpp/blob/<wbr>master/modules/nginx_mod_<wbr>ffeadcpp/ngx_http_ffeadcpp_<wbr>module.cpp</a></div><div><br></div><div>Any help would be greatly appreciated.</div><div><br></div><div><br></div><div>Thanks,</div><div>Sumeet Chhetri</div></div></div></div>