Q:

Nginx routing got cached?

On my VPS I have two virtual servers for: 1) apache app (blog), 2) main app
Blog (lets call it app1) can be accessed as a subdomain via: blog.sitename.com -> app1.
Main app has a language subdomain access as well, so I defined a wildcard access like this:
*.sitename.com -> app2. 
And by default sitename.com resolves to app2. 
Everything worked great up until last Thursday or Friday (don't remember the exact day). 
The problem is: blog.sitename.com started being resolved by app2 (not by app1), so the end-user landed on app2 page and "blog" was treated as a language.  
Also I noticed that this problem didn't occure in some of my browsers (Safari, for example).
I tried clearing the cache and cookies for other browsers and it started working again after that.
Of course I will not be able to explain this to the users of my site, so is there any way to invalidate the cache (or whatever it is) so that everything would start working again?
And yes, I tried setting sendfile off in nginx.conf file and restarting nginx - didn't work.
upstream app2 {
   server unix:/tmp/app2.sock fail_timeout=0; 
}

server {
   server_name blog.sitename.com;

   access_log /var/log/nginx/blog.sitename.com.access.log main;   
   error_log /var/log/nginx/blog.sitename.com.error.log;

   root /var/www/app1; # Wordpress blog

   index index.php;

   location / {
      index index.php;
      try_files $uri $uri/ /index.php?q=$uri&$args;
   }

   location ~ \.php$ {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header Host $http_host;

      proxy_pass http://127.0.0.1:8081;
      proxy_redirect off;
   }

   location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
      expires max;
      log_not_found off;
   }
}

server {
   server_name sitename.com 123.123.123.123;
   rewrite ^(.*) http://www.sitename.com$1 permanent;
}

server {
   listen 80 default deferred; # for Linux
   listen 443 ssl; # Handle SSL connection

   ssl_certificate /root/ssl/ssl.crt;
   ssl_certificate_key /root/ssl/ssl.key;

   client_max_body_size 4G;
   server_name *.sitename.com;  
   root /root/app2/public; 
   keepalive_timeout 10;

   try_files $uri/index.html $uri.html $uri @app;   

   location @app {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme; # HTTP or HTTPS
      proxy_set_header Host $http_host;
      proxy_redirect off;

      proxy_pass http://app2;
   }  

   # serve static assets
   location ~ ^/(assets)/ {
      gzip_static on;
      expires 1y;
      add_header Cache-Control public;
   }

   error_page 500 502 503 504 /500.html;

   location = /500.html {
      root /root/app2/public;
   }
}

A:

OK. Finally I found the source of all my problems!
Never ever ever ever use 301 redirect if are not 100% sure that it should be that way.
301 redirects get cached on a browser level and there is no way to clear it out. 
Use 302 instead. And only when you are 100% sure that everything is correct - implement 301, as it is beneficial for performance.

