title: Send authorization header when accessing URL
body: <p>I want to send the authorization header when I view the webpage of a local IoT device (<a href="http://deviceip" rel="nofollow noreferrer">http://deviceip</a>). The device uses an authorization header encoded in basic.</p>
  
  <p>I have created a web server using Node.js and Express.js with a URL link to the device, but I have not been able to set the authorization header properly and end up with a login prompt.</p>
  
  <p>I have been able to get it working by using a separate proxy server which sends the header upon request and changing the webserver's links to the proxy which sends the authorisation header.</p>
  
  <pre><code>proxy.on('proxyReq', function(proxyReq, req, res, options) { // allows you to alter the proxyreq request object to send authentication before connection
    proxyReq.setHeader('Authorization', auth); // sends Authorazition header auth
  });
  </code></pre>
  
  <p>Is it possible to send the authorization header using a function in the web server when the URL is clicked as opposed to using the proxy?</p>