anchor.diff:        proxy_cache_valid 200 302 300m;
         proxy_cache_valid 404 1m;
       }
  -    
  +
       location / {
       <%= select_upstream("chef_server_api", "chef_server_webui") %>
       }
  
positive.code: <%-
    def select_upstream(upstream, alternative="chef_server_webui", proto="http") 
  <<-EOS
        set $my_upstream #{upstream};
        if ($http_x_ops_userid = "") {
          set $my_upstream #{alternative};
        }
        proxy_redirect #{proto}://$my_upstream /; 
        proxy_pass #{proto}://$my_upstream; 
  EOS
    end
  -%>
  
negative.code: 
      location /checksum/ {
        internal;
        root <%= node['chef_server']['chef-server-api']['checksum_path'].gsub('checksum', '') %>;
      }
  
  <%- if node['chef_server']['lb']['cache_cookbook_files'] -%>
      location ~ "^/cookbooks/[\w\.]+/(\d+\.\d+\.\d+|_latest)/files/.+$" {
  <%= select_upstream("#{node['chef_server']['chef-server-api']['upload_vip']}:#{node['chef_server']['chef-server-api']['upload_port']}", "chef_server_webui", node['chef_server']['chef-server-api']['upload_proto']) %>
        proxy_cache webui-cache;
  