title: Nginx Preserve or Pass custome header after return 301
body: <p>I have nginx which I am receiving http request then I will redirect them to https,</p>
  <pre><code>server {
          listen 80;
          server_name     example.com;
          add_header X-Frame-Options &quot;SAMEORIGIN&quot;;
          return 301 https://example.com$request_uri;
  }
  server {
      listen 443 ssl http2;
      server_name example.com
      .
      .
      .
      location / {
      proxy_http_version 1.1;
      proxy_set_header X-Forwarded-Proto  $scheme;
      proxy_set_header Host               $host;
      proxy_set_header X-Real-IP          $remote_addr;
      proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto  $scheme;
      proxy_pass http://$backend_server;
   }
  </code></pre>
  <p>I have  2 custom header which named :</p>
  <pre><code>x_sub_ch1 
  x_sub_ch2 
  </code></pre>
  <p>I want to have them with proxy_pass , I have tried below but does not work, would you please let me know I can add these 2 custom header to proxy_pass:</p>
  <pre><code>server {
          listen 80;
          server_name     example.com;
          add_header X-Frame-Options &quot;SAMEORIGIN&quot;;
          return 301 https://example.com$request_uri;
  }
  server {
      listen 443 ssl http2;
      server_name example.com
      .
      .
      .
      location / {
      proxy_http_version 1.1;
      proxy_set_header X-Forwarded-Proto  $scheme;
      proxy_set_header Host               $host;
      proxy_set_header X-Real-IP          $remote_addr;
      proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto  $scheme;
  
      # proxy_set_header X-Sub_Ch1          $http_x_sub_ch1; # this does not work
      # proxy_set_header X-Sub_Ch1          $http_x_sub_ch2; # this does not work
  
      proxy_set_header X-Sub_Ch1          $http_x-sub-ch1; # this does not work
      proxy_set_header X-Sub_Ch1          $http_x-sub-ch2; # this does not work
  
      proxy_pass http://$backend_server;
   }
  </code></pre>