From: Gustaf N. (sslmail) <ne...@wu...> - 2024-05-03 12:13:40
|
There are multiple processing steps involved in your example. One thing is how to use the URLspace mappings (responsible for all kinds of requests, but not only), where the URL ordering plays a rule, and the another thing are request filters, which are fully independent of the URLspace. Given the lifecycle of requests, the resolving of the requests happens in the step “process request” below: Once a connection thread is selected, the server runs filters (pre-auth and post-auth) and then it runs the request procs.  There might be multiple of these filters, where the registration order is relevant. A filter might decide to continue to the next filter or send a reply to the client. This is singled via the result of the filter procs. A filter should return one of the three values “filter_ok”, “filter_break” or “filter_return” (for details, check the man page of ns_register) https://naviserver.sourceforge.io/n/naviserver/files/ns_register.html#3 In your case, the reverse proxy is registered via a match-all post-auth filter (/*) ending with a “filter-return” which has the consequence no request-proc (such as fastpath) will be involved. So registering additional request procs won’t make a difference. In your example, one could either register an additional filter at the beginning of the filter change that lets the static requests through (ending with filter_break),, or one could consider moving the handling of the reverse proxy to the URLspace, by registering the handlers via ns_register_proc instead of using ns_register_filter. Hope this explains, all the best -g > On 02.05.2024, at 16:33, Georg Lehner <jor...@ma...> wrote: > I am trying to configure Naviserver as reverse proxy for a Django project. > > Django features deployment of static assests like css, js etc. into a separate URL, typically /static, which can then be served directly by the webserver. Everything else has to be reverse-proxied to the wsgi server which serves the Django app via http. > > My revproxy setup is: > > ns_section ns/server/default { > ns_param enabletclpages false > ns_param minthreads 10 > } > ns_section ns/server/default/fastpath { > ns_param pagedir www > ns_param serverdir $serverroot/default > ns_param directoryproc ns_returnnotfound > ns_param directoryfile index.html > } > ns_section ns/server/default/modules { > ns_param revproxy tcl > ns_param nssock nssock > } > ns_section ns/server/default/module/revproxy { > ns_param filters { > ns_register_filter postauth GET /* ::revproxy::upstream -target http://localhost:65193 <http://localhost:65193/> > ns_register_filter postauth POST /* ::revproxy::upstream -target http://localhost:65193 <http://localhost:65193/> > } > } > ns_section ns/server/default/module/nssock { > ns_param port 0 > } > I have made several attempts to register the /static/* URL to be handled by fastpath and map it to a directory have failed. The server always sends the requests to the revproxy backend. > Is it possible to "override" this, and if yes then how? > > Best Regards, > > Georg > |