title: nginx proxy_pass check upstream content type
body: <p>I want to give a simple 403 forbidden error if source server return <strong>application/vnd.error+json</strong> for content type.
  Here is my code:</p>
  
  <pre><code>server {
  root /var/www/;
  recursive_error_pages on;
          location / {
              proxy_pass                      "http://source";
              proxy_set_header Host           "source";
              proxy_pass_request_headers      on;
              proxy_intercept_errors          on;
              if ($upstream_http_content_type = "application/vnd.error+json" ) {
                return 403;
              }
          }       
  }
  </code></pre>
  
  <p>But it dont returns me 403 error. It returns the source server's content. How can I modify status code, headers and body which sent to client?</p>