back

by nikolay·10y ago·view on hn ↗
I was considering Varnish + Nginx at some point, but this gets much more complicated than just using ATS.
1 comments
It makes sense, considering that nginx is typically ahead of the pack on support for things like SPDY and H2. Plus if you use OpenResty with its Lua functionality, you can do a lot of fancy things in nginx and reduce your dependency on Varnish's VCL. And you have to have something in front of Varnish to do SSL anyway.

VCL in particular is kind of a trap. Early on it can do what you need -- remove a header, set a header, basic branching. Then you want to do basic arithmetic, or validity checking, or anything that isn't suitable for string assignment or regex and you straight up can't do it. VCL makes me long for the power of bash scripts.

Ultimately though, it's really not a great solution to separate these concerns between multiple applications. You're going to get bitten somewhere, even if it's just the old ephemeral port exhaustion problem.

That is true. I was particularly interested in tag-based cache purge and although there are similar open-source Nginx modules [0] and [1], they still don't have that out of the box.

[0]: https://github.com/pintsized/ledge

[1]: https://github.com/wandenberg/nginx-selective-cache-purge-mo...

Tag-based cache purges are something I would love to see in ATS. I think doing it correctly would require a complete rejiggering of the cache storage though, and that's not something to be undertaken lightly.

Storing externally in redis (for ledge) seems like the wrong approach to me. Better to store metadata externally and generate the purge URLs based on that. It's not ideal, but it's the best option I've come up with.

It's an essential feature that is dragging me towards Varnish even if this comes with tons of negatives.The bans feature is just amazing.

And right or wrong, there are not that many implementations to choose from in the Nginx land, unfortunately.