Public Access
CertZipDL
This commit is contained in:
@@ -133,6 +133,26 @@ function startRedirectServer() {
|
||||
|
||||
http
|
||||
.createServer((req, res) => {
|
||||
// A zip, because browsers block bare certificate downloads.
|
||||
if (req.url === '/ca.zip') {
|
||||
try {
|
||||
const zip = tls.caBundleZip();
|
||||
if (!zip) {
|
||||
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
||||
return res.end('No certificate authority has been generated yet.');
|
||||
}
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'application/zip',
|
||||
'Content-Disposition': 'attachment; filename="visitor-signin-certificates.zip"',
|
||||
'Content-Length': zip.length,
|
||||
});
|
||||
return res.end(zip);
|
||||
} catch (err) {
|
||||
res.writeHead(500, { 'Content-Type': 'text/plain' });
|
||||
return res.end(`Could not build the bundle: ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
// DER for Apple tooling, PEM for everything else.
|
||||
if (req.url === '/ca.cer' || req.url === '/ca.der') {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user