Is there a defined way to cancel an upstream proxy request from within the
::revproxy::upstream filter?

This is the case I can't quite see a way forward with..

GET /folder1/page.html

when requested via port 443 we would want to reply via fastpath delivery
with no proxying.
when via port 8443 we would want to proxy this upstream.

So I need to add a filter on /folder1 to deal with the 8443 case:

ns_register_filter preauth GET   /folder1*  ::revproxy::upstream -target
https://${server1} -url_rewrite_callback upstream_url_rewrite

However, I can't see how we can cancel the ::upstream request from within
when on port 443 and let the request fall through to fastpath delivery.
I can simulate this case* by doing the fastpath return using
ns_returnfile within
the upstream_url_write callback and returning "" as the url... but this
feels like a bit of an abuse of the proc - since I'm not rewriting the URL,
I'm replying to the request.
(*if the following line returns "filter_return" )
https://bitbucket.org/naviserver/revproxy/src/4c2e6e5b7b5d7dfe80a134d5b818dbf46305517f/revproxy-procs.tcl#lines-78


On Mon, 21 Dec 2020 at 11:30, Gustaf Neumann <neum...@wu.ac.at> wrote:

>
> On 21.12.20 10:58, David Osborne wrote:
>
> As far as I can remember, the multiple servers are to make routing more
> convenient.
>
> well, it is not the main purpose of multiple servers :)
> However, with the changes of yesterday, your use case should work just
> fine.
>
> I'm guessing I could be using url_rewrite_callback to achieve this...?
> I've not explored that yet but will do now..
>
> yes, the url_rewrite_callback can be used to compute a fully qualified URL
> based on
>
>     nsf::proc rewrite_url { -target -url {-query ""}} {....}
>
> In this callback, one can e.g. query the incoming port and redirect e.g.
> the request to a different machine with a different path, etc.
>
> -g
>
>
>
> _______________________________________________
> naviserver-devel mailing list
> naviserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/naviserver-devel
>


-- 

*David Osborne | Software Engineer*
Qcode Software, Castle House, Fairways Business Park, Inverness, IV2 6AA
*Email:* da...@qcode.co.uk | *Phone:* 01463 896 484
www.qcode.co.uk
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to