Skip to content

Instantly share code, notes, and snippets.

@zemirco
Created May 15, 2013 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zemirco/5586728 to your computer and use it in GitHub Desktop.
Save zemirco/5586728 to your computer and use it in GitHub Desktop.
node proxy basic auth
var cors_proxy = require("corsproxy");
var http_proxy = require("http-proxy");
cors_proxy.options = {
// this is not working
target: "user:pw@https://mirco.cloudant.com/pouchdb"
};
http_proxy.createServer(cors_proxy).listen(1234, function() {
console.log('cors proxy server listening on port 1234')
});
// i know i have to set the 'Authorization' header, but where?
header.Authorization = 'Basic ' + new Buffer('user' + ':' + 'pw').toString('base64');
@gr2m
Copy link

gr2m commented May 15, 2013

  1. send the HTTP auth header with the XHR request
  2. I think you manually have to set a crossDomain flag with each XHR request as well. Try to make a request with jQuery first. If that works, ask over at PouchDB where to set the flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment