Nginx proxy upstream cached?

Posted by Julian H. Lam on Server Fault See other posts from Server Fault or by Julian H. Lam
Published on 2013-10-15T12:53:50Z Indexed on 2013/11/05 21:57 UTC
Read the original article Hit count: 239

Filed under:
|
|

Attempting to resolve an issue that's been annoying me for a bit. I've distilled the symptoms into a set of reproducible steps:

  1. 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)

  2. 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.

  3. 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;
    }                                   }
    

  4. Site A and Site B have nothing to do with each other.

  5. Yes, I am restarting (reloading, actually) nginx every time I make a change.

  6. 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...

© Server Fault or respective owner

Related posts about nginx

Related posts about proxy