introducing vmod_fileserver

Guillaume Quintard guillaume.quintard at gmail.com
Mon Dec 26 21:34:05 UTC 2022


Happy holidays to you all!

I had a few days off, so of course I decided to finally get some hacking
time on Varnish, and decided to once again spend some time on rust and
backends. Here's what I got: https://github.com/gquintard/vmod_fileserver

As the name suggests, this vmod allows you to serve files directly from
disk, without relying on an external backend. That can be useful for a
bunch of things like returning a healthcheck file generated by another
process, providing an error page in case of backend failure, or just to
provide some test data quickly.

Essentially, this vmod:
- allows you to set a root directory and serve files from there
- supports HEAD/GET
- supports conditional requests with if-none-match and if-modified-since

The API is minimal, and the code hasn't seen any production traffic yet, so
be careful! But if you can test it and there are some use cases not covered
here, I'll happily hear your feedback.

Also, if you are a C developer curious about rust, you might want to look
at the code:
https://github.com/gquintard/vmod_fileserver/blob/main/src/lib.rs
I commented it as much as I could, and because varnish-rs is far from
complete, you'll see a lot of C idiosyncrasies that aren't "hidden" by
rust, and therefore the code might look more familiar.

Anyway, that's all for me, let me know what you think!

-- 
Guillaume Quintard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20221226/676aee3f/attachment.html>


More information about the varnish-misc mailing list