Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding support of hosting https mirror? #75

Open
eidng8 opened this issue Jan 18, 2017 · 1 comment
Open

adding support of hosting https mirror? #75

eidng8 opened this issue Jan 18, 2017 · 1 comment

Comments

@eidng8
Copy link

eidng8 commented Jan 18, 2017

This is a great tool, thanks for the good work!

Currently it only supports hosting http mirror, it would be great to have https: too.

I'm not familiar with nodejs, I mostly write web site codes. But it seems to me adding https: supports is easy as adding a few config values and code lines to

var server = http.createServer();

var server;
if(!!config.secure) {
  if(!config.server_key || !config.server_cert) {
    throw new Error('Please specify server certificates');
  }
  server = https.createServer({
    key: fs.readFileSync(config.server_key),
    cert: fs.readFileSync(config.server_cert)
  });
} else {
  server = http.createServer();
}

Is it?
server.on('request', function(req, res) {
  // snipped...
}).listen(config.port, config.host);
@sglajchEG
Copy link

I was unable to get this work entirely.
First off, at the top of server.js I had to also add an https require require('https'),.
Also I changed the "externalUrl:" in the config file to be https instead of http.
After that, when I manually navigate to my proxy, I get valid files, and I can even download dependencies ,but neither npm nor yarn will actually install packages from it. I did change my registry URL in npm and yarn to the new https URL, and even cleared cache for both locally, but had no luck.

Let me know if you ever got this working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants