Tag: https

使用Node JS设置Cloud9 SSL应用程序

我一直在玩Cloud9 IDE,并且玩得很开心。 但是,我试图设置一个简单的https服务器与节点js,我似乎无法得到它的工作。 当我运行这个页面时,Cloud9会说'正在运行的节点进程',但是当我访问服务器应该回应的URL时: https : //workspace.user.c9.io页面显示 Service Temporarily Unavailable The server you are trying to contact is down either because it was stopped or is unable to service your request due to maintenance downtime or capacity problems. Please try again later. node-web-proxy/0.4 Server at project-livec9f70a01ca28.rhcloud.com Port 8000 我用OPENSSL创build了一个testing证书,并使用下面的代码来设置我的服务器。 我可以确认OPENSSL证书是正确构build的。 var https = require("https"); var […]

Express(node.js)使用HTTPS和HTTP

我在node.js上使用express(3.0)框架来路由我的应用程序。 我的大部分应用程序都使用http协议,但是我只想通过https服务一条特定的路线。 这是我的API的一部分,它负责注册和authentication用户。 例如: app.get('/connect', function(req, res){ // Must be on HTTPS, if not redirect to HTTPS }); app.post('/connect', function(req, res){ // Must be on HTTPS }); app.get('/', function(req, res){ // Must be on HTTP }); app.get('/build', function(req, res){ // Must be on HTTP }); 如何在同一个应用程序中使用两者? 我正努力在野外find任何这样的例子。

如何使用基于Node.js映像的Docker容器encryption

我在基于Node.js映像的Docker容器中运行基于Express的网站。 如何使用基于该图像的容器进行encryption ?

macvalidation失败使用节点与SSL证书

正如Node api文档中所指定的那样,我使用openssl自己创build并签署了一个cert来尝试第一个。 一切都很好,除了不能从androidtesting客户端的事实,因为它需要一个CA证书。 当我尝试第二个方法(用pfx而不用key,cert)时,https.createserver会抛出一个错误 crypto.js:145 c.context.loadPKCS12(pfx); ^ Error: mac verify failure at Object.exports.createCredentials (crypto.js:145:17) at Server (tls.js:1130:28) at new Server (https.js:35:14) at Object.exports.createServer (https.js:54:10) at Object.<anonymous> (C:\iTollonServer\iTollonServer\iTollonServer\app.js:105:7) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) 来自Node Api的代码: // curl -k https://localhost:8000/ var https = require('https'); var fs = […]

在最新的Node&NPM下,Express服务器的SSL握手失败

我升级了Mac上的Node.js到最新的0.12.4,以及NPM到2.10.1,并且我为我的Express项目重新运行了npm install。 现在,当我访问https:// localhost:3001时 ,我在Chrome中得到“这个网页不可用/ ERR_CONNECTION_REFUSED”。 当我运行curl -v https://localhost:3001我得到 curl -v https://localhost:3001/ * Hostname was NOT found in DNS cache * Trying ::1… * Connected to localhost (::1) port 3001 (#0) * Server aborted the SSL handshake * Closing connection 0 curl: (35) Server aborted the SSL handshake 这肯定是升级Node.js的结果,因为升级后立即出现问题。 我开始这样的服务: options = { key: fs.readFileSync('sslkey.pem'), […]

如何通过https使用私有GitLab存储库作为与私有令牌的npm依赖关系

我试图在我的节点js应用程序中使用私有GitLab回购作为npm依赖关系,使用私有令牌密钥,如下所示: "dependencies": { "my-module": "git+https://<privateToken>:x-oauth-basic@<myGitLabURL>/<MyUser>/my-module.git" } 当我运行npm install我得到有关git克隆fatal: unable to access <git repo path>错误fatal: unable to access <git repo path>与443连接被拒绝的答复。 我找不到很多关于如何通过https而不是通过ssh来完成的文档。 它似乎在GitHub上工作 有人在GitLab上使用Https有这方面的经验吗?

安装根证书到Node.js(HTTPS客户端)

我想用Node.js作为客户端通过HTTPS连接到内部公司服务器。 如何将我的内部根证书安装到Node.js中,以便证书validation成功? 我不想禁用证书validation。

使用StartSSL证书在Mac OSX上的Node.js上启动HTTPS时出错

我正在拆分头发试图使用StartSSL证书运行HTTPS服务器。 我从他们那里获得了所有必要的文件,并通过将它们传递给createServer参数来使用它们: var options = { ca: FS.readFileSync('sub.class1.server.ca.pem'), key: FS.readFileSync('ssl.key'), cert: FS.readFileSync('ssl.crt') }; 这是我得到的错误。 Error: error:0906D06C:PEM routines:PEM_read_bio:no start line at Object.createCredentials (crypto.js:87:31) at HTTPSServer.Server (tls.js:914:28) at HTTPSServer.Server (https.js:33:14) at HTTPSServer.HTTPSServer (/Users/myUserName/node_modules/connect/lib/https.js:34:16) at new HTTPSServer (/Users/myUserName/node_modules/express/lib/https.js:38:23) at Object.createServer (/Users/myUserName/node_modules/express/lib/express.js:43:12) at Object.<anonymous> (/Users/myUserName/Sites/node.js/https/app.js:12:36) at Module._compile (module.js:441:26) at Object..js (module.js:459:10) at Module.load (module.js:348:31) 我想也许我应该把证书转换成PEM。 但是运行: openssl x509 -in […]

使用mocha和超级testing的NodeJS HTTPS APItesting – “DEPTH_ZERO_SELF_SIGNED_CERT”

我需要使用mocha和super test来testing通过HTTPS提供的API(证书未过期) 这是服务器的要点: … var app = express(); var _options = { key: fs.readFileSync('my-key.pem');, cert: fs.readFileSync('my-cert.pem') }; // Start HTTPS server https.createServer(_options, app).listen(app.get('port'), app.get('ip'), function () { // ok or not logs }); 这是要testing的路线 app.get('/hello',function (req, res) { res.json(200); }); 我试图用这个代码在test/test.js中test/test.js var supertest = require('supertest'), api = supertest('https://localhost:3000'); describe('Hello test', function () { it('hello', function […]

如何监控类似于Chrome / Firefox开发人员工具的node.js上的networking?

在开发客户端JavaScript应用程序时,开发人员networking面板对于debuggingnetworking问题非常重要: 创buildNodeJS应用程序的开发人员如何监控从nodejs应用程序到http / https服务器的networkingstream量? 例如如何debugging以下networkingstream量? var http = require('http'); var req = http.request … req.write … req.send() 我的代码正在打给第三方的https服务器,所以我无法使用wireshark或类似的数据包嗅探工具。 欲了解更多信息,我试图调查的问题在这里 。 编辑: 这里有类似的问题,要求如何在其他语言中做同样的事情: PYTHON: 我怎样才能看到我的Python应用程序发送的整个HTTP请求? JAVA: 如何在Android上启用Apache公共HttpClient日志logging