title: Redirect with basic auth to another website (in node)
body: <p>How to redirect to another website with basic auth (in node)</p>
  
  <p>Here is my code</p>
  
  <pre><code>const headers = {
    Authorization: "Basic " + 
    new Buffer(USER + ":" + PASS).toString("base64")
  };
  
  ctx.response.set(headers);
  ctx.response.redirect(URL)
  </code></pre>
  
  <p>The First Response return with basic auth</p>
  
  <pre><code>Authorization →Basic QWRxXxXxYWRtaW4=
  Connection →keep-alive
  Content-Length →111
  Content-Type →text/html; charset=utf-8
  Date →Fri, 15 Dec 2017 21:49:57 GMT
  Location →http://localhost:8080/edit/data/P0000013
  </code></pre>
  
  <p>The following redirected GET request doesn't contain basic auth and got redirected again, to a log-in page.</p>
  
  <pre><code># General
  Request URL:http://localhost:8080/edit/data/P0000013
  Request Method:GET
  Status Code:302 Found
  Remote Address:[::1]:8080
  Referrer Policy:no-referrer-when-downgrade
  
  # Request Header
  Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
  Accept-Encoding:gzip, deflate, br
  Accept-Language:en-US,en;q=0.9
  Connection:keep-alive
  Cookie:....
  Host:localhost:8080
  Upgrade-Insecure-Requests:1
  User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36
  </code></pre>