We've been using Nginx as a caching proxy for quite a while in different scenarios now. Since a few weeks and especially in the last couple of days we continue to encounter a strange behaviour in one of our scenarios leading to wrong content being delivered.
In that case we use Nginx as a caching proxy for a bunch of subdomains on a kind of multitenancy application. We established the setup 4 months ago and never had any problems until recently.
For example, a request to https://test.example.org/bla/fasel would deliver the content for https://foo.example.org/bla/fasel. So basically it delivers content for the wrong subdomain. Those occasions are very, very rare and totally random in regards to the subdomain from which the content gets delivered.
We currently use openresty 1.13.6.1.
Our config is quite large, so I will put it into a gist if that's OK: https://gist.github.com/benzimmer/a4ee7b43ae4ade24a570301dfd0c12c2
This seems to be working fine for the most part, but every now and then we see the described behaviour without being able to consistently reproduce it.
If anyone has any clue why this might be happening, we'd be very grateful. If you need any additional information, please feel free to ask away!