title: Finding ways to change request Authorization header from Bearer to Basic going through Nginx
body: <p>Our web app is integrated with telerik reporting module which is not native angular library, so changing the authorization header by intercepting the http requests is not possible. At the server side, there is a nginx server listening the web app requests and sending those to a tunnel server in reverse proxy, we can not change anything in the tunnel server.</p>
  <p>the web app sends request with a authorization header like this, Bearer {Base64BasicToken}, so In Nginx config, if request path starts with Segment like this &quot;api/telerik/reports&quot;, we would like to change Authorization Header value from the Bearer {Base64BasicToken} to Basic {Base64BasicToken}.</p>
  <pre><code>server {
  
          listen 443;
          server_name *.tunnel.xxx.xxx;
          ssl on;
          ssl_certificate /etc/letsencrypt/live/tunnel.xxx.xxx/fullchain.pem;
          ssl_certificate_key /etc/letsencrypt/live/tunnel.xxx.xxx/privkey.pem;
          ssl_protocols TLSv1.2 TLSv1.1;
  
          # add_header Access-Control-Allow-Origin *;
          # add_header Access-Control-Allow-Credentials true;
          # add_header Access-Control-Allow-Methods 'GET,POST,PUT,DELETE,OPTIONS,HEAD';
          # add_header 'Access-Control-Allow-Headers' 'Origin,X-Requested-With,Content-Type,Content-Length,Authorization,append,delete,entries,foreach,get,has,keys,set,values';
  
          location / {   
          
  
              if ($request_method = 'OPTIONS') {
  
                  add_header Access-Control-Allow-Origin *;
                  add_header Access-Control-Allow-Credentials true;
                  add_header Access-Control-Allow-Methods 'GET,POST,PUT,DELETE,OPTIONS,HEAD';
                  add_header 'Access-Control-Allow-Headers' 'Origin,X-Requested-With,Content-Type,Content-Length,Authorization,append,delete,entries,foreach,get,has,keys,set,values';
                  return 200;
              }
  
  
              allow all;
              proxy_set_header Host $host;
              proxy_set_header Connection &quot;upgrade&quot;;
              proxy_set_header Connection $http_connection;
              proxy_pass http://127.0.0.1:82;           
  
              # WebSocket support
              proxy_http_version 1.1;
              proxy_set_header Upgrade $http_upgrade;
   
   }
  </code></pre>
  <p>Your inputs are much appreciated.</p>