I wound back a bit. Using different packages looks like other projects. My working assumption is that if I can get the proxy to work using solid-auth-client, then it should work for anything and I really want to get a release of the proxy out the door. So, I’m still using solid-auth-client for now. I have been looking through headers and as mentioned above, done some experiments trying to pass-through on connection first, but haven’t cracked it.
Below is a very simple pass-through. The web page uses solid-auth-client. The simple proxy works for public resources. My web page – when not going through the proxy — can get private resources. What do I need to pass through in order to get private resources through the proxy?
const target = {
protocol: 'https:',
hostname: 'rogerfgay.solid.hll.nu',
port: 7443,
method: 'get'
}
// path: "/public/hello.txt",
let server = https.createServer(options, proxyApp).listen(8440);
function proxyApp (request,response) {
console.log("URL: " + request.url);
if (request.url == '/index.htm' || request.url == '/solid.js') { // solid.js makes solid-auth-client calls
serveFile(request.url,response);
} else {
runProxy(request,response);
}
}
function runProxy (request,response) {
let req = https.request(target, function (res) {
res.pipe(response, { end: true });
})
.on('error', e => {
console.log("req on error " + e.stack);
});
target.path = request.url;
request.url = target.protocol + '//' + target.hostname + ':' + target.port + request.url;
request.pipe(req, { end: true });
}`