title: Adding and using header (HTTP) in nginx
body: <p>I am using two system (both are Nginx load balancer and one act as backup).</p>
  
  <p>I want to add and use few HTTP custom headers.</p>
  
  <p>Below are my codes for both;</p>
  
  <pre><code>upstream upstream0 {
      #list of upstream servers
      server backend:80;
      server backup_load_balancer:777 backup;
      #healthcheck
  }
  
  server {
      listen 80;
      #Add custom header about the port and protocol  (http or https)
      server_name _;
  
      location / {
          # is included since links are not allowed in the post
          proxy_pass "http://upstream0;"
      }
  }
  </code></pre>
  
  <p>Backup system</p>
  
  <pre><code>server {
      listen 777;
      server_name _;
      #doing some other extra stuff
      #use port and protocol to direct
  }
  </code></pre>
  
  <p>How can I achieve that?</p>