我正在使用Restfar库来使用来自UWP的API-REST。当我在服务器上使用API时,一切正常,因为SSL证书与此证书匹配,但是当我在本地工作时,它对我不起作用。我想在本地忽略证书,但我找不到一个选项。有谁知道如何禁用它们或忽略此库中的证书?谢谢=)
在远程代码中:
var ssl_options = {
key: fs.readFileSync('./keys/file.key'),
cert: fs.readFileSync('./keys/file.crt'),
ca: fs.readFileSync('./keys/file.ca-bundle')
};
var api = require('./routes/routes');
var app = express();
var secureServer = https.createServer(ssl_options, app);
app.use((req, res, next) => {
res.header('...', '...');
...
next();
});
app.use(forceSSL);
app.use('/apirest', api);
secureServer.listen(portNumber);
在本地代码中:
//var ssl_options = {
// key: fs.readFileSync('./keys/file.key'),
// cert: fs.readFileSync('./keys/file.crt'),
// ca: fs.readFileSync('./keys/file.ca-bundle')
//};
var api = require('./routes/routes');
var app = express();
var server = http.createServer(app);
app.use((req, res, next) => {
res.header('...', '...');
...
next();
});
//app.use(forceSSL);
app.use('/apirest', api);
server.listen(portNumber);