title: How to resolve Nginx "proxy_pass 502 Bad Gateway" error
body: <p>I have trying to add proxy_set_header in my nginx.conf file. When I try to add proxy_pass and invoke the URL it throws 502 Bad Gateway nginx/1.11.1 error.</p>
  
  <p>Not sure how to resolve this error:</p>
  
  <pre><code>upstream app-server {
      # connect to this socket
      server unix:///tmp/alpasso-wsgi.sock;    # for a file socket
  }
  
  server {
      server_name &lt;name&gt;;
  
      listen 80 default_server;
  
      # Redirect http to https
      rewrite ^(.*) https://$host$1 permanent;
  }
  
  server {
      server_name &lt;name&gt;;
  
      listen 443 ssl default_server;
  
      recursive_error_pages on;
  
      location /azure{
          proxy_pass http://app-server;
      }
  
      ssl on;
      ssl_certificate      /etc/nginx/server.crt;
      ssl_certificate_key  /etc/nginx/server.key;
      ssl_client_certificate /etc/nginx/server.crt;
      ssl_verify_client optional;
  }
  </code></pre>