Nginx proxy upstream cached?
- by Julian H. Lam
Attempting to resolve an issue that's been annoying me for a bit. I've distilled the symptoms into a set of reproducible steps:
I have two sites, siteA, and siteB. They are both Node.js applications running on different ports (for the sake of example, 4567 and 4568)
Both applications have their own file in sites_available (plus a symlink from sites_enabled), which contain the directives proxy_pass http://node_siteA/ and proxy_pass http://node_siteB/ respectively, inside of a location block.
They also each have an upstream block (defined globally?):
upstream node_siteA { upstream node_siteB {
server 127.0.0.1:4567; server 127.0.0.1:4568;
} }
Site A and Site B have nothing to do with each other.
Yes, I am restarting (reloading, actually) nginx every time I make a change.
If I take down site B and attempt to access it via the web, I am served site A.
Why is this?
Thoughts
Other times, when I create a new Site C, for example, nginx refuses to show me anything except "Welcome to nginx!" for ~5 minutes. This suggests a resolver timeout, perhaps?
When I access Site B after its config has been deleted, and it sends me to Site A, this sounds like nginx sending me to servers in a round-robin fashion...