<div dir="auto">Hi!<div dir="auto"><br></div><div dir="auto">You are correct, the request body is, by default, not cached. To correct this, you need to use the cache_req_body() function from the std vmod: <a href="https://varnish-cache.org/docs/trunk/reference/vmod_std.html#std-cache-req-body">https://varnish-cache.org/docs/trunk/reference/vmod_std.html#std-cache-req-body</a></div><div dir="auto"><br></div><div dir="auto"><self promotion time></div><div dir="auto">I haven't looked at the vcl yet (or the article), but since you mention vmod_curl, maybe you can try with vmod_reqwest instead (<a href="https://github.com/gquintard/vmod_reqwest">https://github.com/gquintard/vmod_reqwest</a>). It's a bit different, but hopefully more powerful, and I'd love to get some feedback on it.</div></self promotion time><div dir="auto"><br></div><div dir="auto">Hope that helps!<br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Tue, Jul 26, 2022, 00:03 Tom Anheyer | BerlinOnline <<a href="mailto:tom.anheyer@berlinonline.de">tom.anheyer@berlinonline.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I try to use vouch-proxy and varnish (v7) together to build a authorisation<br>
proxy. vouch-proxy is written to work with nginx ngx_http_auth_request_module<br>
<br>
<a href="https://github.com/vouch/vouch-proxy" rel="noreferrer noreferrer" target="_blank">https://github.com/vouch/vouch-proxy</a><br>
<a href="https://nginx.org/en/docs/http/ngx_http_auth_request_module.html" rel="noreferrer noreferrer" target="_blank">https://nginx.org/en/docs/http/ngx_http_auth_request_module.html</a><br>
<br>
Idea:<br>
<br>
inspired from <br>
<a href="https://web.archive.org/web/20121124064818/https://adayinthelifeof.nl/2012/07/06/using-varnish-to-offload-and-cache-your-oauth-requests/" rel="noreferrer noreferrer" target="_blank">https://web.archive.org/web/20121124064818/https://adayinthelifeof.nl/2012/07/06/using-varnish-to-offload-and-cache-your-oauth-requests/</a><br>
<br>
- use varnish request restart feature<br>
- intercept original client request and make a GET request to vouch-proxy<br>
validate endpoint<br>
- when validated restore the original request and do a restart <br>
<br>
in detail:<br>
<br>
# vcl_recv<br>
#   restarts == 0<br>
#       save req method, url, Content-Length, Content-Type in var<br>
#       method := GET<br>
#       url := /validate<br>
#       backend := vouch-proxy<br>
#       remove Content-Length, Content-Type<br>
#   restarts > 0<br>
#       check vouch-proxy headers (roles, groups)<br>
#<br>
# vcl_deliver<br>
#   resp == vouch-proxy,GET,/validate,200<br>
#       restore req method, url, Content-Length, Content-Type from var<br>
#       forward vouch-proxy response headers to req<br>
#       restart (original) req<br>
<br>
see attached common-vouch-proxy.vcl<br>
<br>
It works for client requests without request body (GET, HEAD, …) but not for<br>
POST, PUT, …. POST, PUT run in timeouts, so I think the request body is lost in<br>
the restarted request. Why is the body gone after restart?<br>
<br>
I think it should work with the curl vmod but this is not integrated yet.<br>
<br>
Thank you very much in advance<br>
tom<br>
<br>
-- <br>
Tom Anheyer<br>
Senior Developer<br>
<br>
BerlinOnline Stadtportal GmbH & Co. KG<br>
Stefan-Heym-Platz 1<br>
10365 Berlin<br>
Germany<br>
<br>
Tel.: +49 30 2327-5210<br>
Fax: +49 30 5771180-95<br>
E-Mail: <a href="mailto:tom.anheyer@berlinonline.de" target="_blank" rel="noreferrer">tom.anheyer@berlinonline.de</a><br>
<br>
<a href="http://berlin.de" rel="noreferrer noreferrer" target="_blank">berlin.de</a> | <a href="http://berlinonline.net" rel="noreferrer noreferrer" target="_blank">berlinonline.net</a><br>
<br>
Amtsgericht Berlin-Charlottenburg, HRA 31951<br>
Sitz der Gesellschaft: Berlin,<br>
Deutschland<br>
USt-IdNr.: DE219483549<br>
<br>
Persönlich haftender Gesellschafter:<br>
BerlinOnline Stadtportalbeteiligungsges. mbH<br>
Amtsgericht Berlin-Charlottenburg, HRB 79077<br>
Sitz der Gesellschaft: Berlin, Deutschland<br>
<br>
Geschäftsführung: Olf Dziadek, Andreas Mängel<br>
Amtierender Vorsitzender des Aufsichtsrates: Lothar Sattler<br>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank" rel="noreferrer">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div></div></div>