使用node.js设置SSL(Setting up SSL with node.js)
我在GoDaddy购买了SSL证书,我正在使用以下node.js服务器来尝试设置它:
var https = require('https'), // module for https fs = require('fs'); // required to read certs and keys var options = { key: fs.readFileSync('../../ssl/example.com.key'), cert: fs.readFileSync('../../ssl/example.com.crt'), ca: fs.readFileSync('../../ssl/gd_bundle.crt'), requestCert: true, rejectUnauthorized: false }; https.createServer(options, function (req, res) { if (req.client.authorized) { res.writeHead(200, {"Content-Type": "application/json"}); res.end('{"status":"approved"}'); } else { res.writeHead(401, {"Content-Type": "application/json"}); res.end('{"status":"denied"}'); } }).listen(443);
运行服务器后,我试图访问https://example.com网站,我就得到了
{"status":"denied"}
我想这是正常的,因为我得到了回复,但我认为我对SSL如何工作的理解是错误的。 我认为浏览器从服务器获取证书,然后根据根证书(即GoDaddy)对其进行身份验证。 所以我不应该得到
{"status":"approved"}
只需访问https://example.com ?
所以我想我的问题是,如何访问https://example.com并获取{“status”:“approved”}?
谢谢!
I bought an SSL certificate at GoDaddy and I'm using the following node.js server to attempt to set it up:
var https = require('https'), // module for https fs = require('fs'); // required to read certs and keys var options = { key: fs.readFileSync('../../ssl/example.com.key'), cert: fs.readFileSync('../../ssl/example.com.crt'), ca: fs.readFileSync('../../ssl/gd_bundle.crt'), requestCert: true, rejectUnauthorized: false }; https.createServer(options, function (req, res) { if (req.client.authorized) { res.writeHead(200, {"Content-Type": "application/json"}); res.end('{"status":"approved"}'); } else { res.writeHead(401, {"Content-Type": "application/json"}); res.end('{"status":"denied"}'); } }).listen(443);
After running the server, I attempted to visit the website at https://example.com and I just get
{"status":"denied"}
I guess this is working properly since I'm getting a response, but I think my understanding of how SSL works is wrong. I thought the browser gets the certificate from the server, which then authenticates it against root certs, i.e. from GoDaddy. so shouldn't i get
{"status":"approved"}
just simply visiting https://example.com ?
So I guess my question is, how do I visit https://example.com and get {"status":"approved"}?
Thanks!
原文:https://stackoverflow.com/questions/11804168
满意答案
这似乎是由于Excel处理“空”单元格的方式。 似乎没有办法返回一个正确的空单元格,但之前已经讨论过不同的解决方法:
Using a filter to select all data points that should be hidden and then deleting the contents of the cell works.
As I have lots of charts to do this to I was able to implement the "filter and delete" process using .Autofilter and .ClearContents methods.
相关问答
更多R in()函数:当最后一个值为NA时出现意外错误(R within() function: unexpected error when last value(s) are NA)
如果数据是NA,则不绘制图表的轴?(Not plotting the axis of a chart if data is NA?)
大熊猫在na_values和转换器之间的read_excel干扰bug?(Pandas read_excel interference between na_values and converters bug?)
Excel 2013 - “移动到另一张表”的微型图表错误?(Excel 2013 - Miniature chart bug on “move to another sheet”?)
使用= NA()时的Excel图表错误(Excel Chart Bug when using =NA())
R语言NaN + NA行为(R Language NaN + NA behaviour)
用NA替换(replace with NA)
rollum产生意想不到的NA(rollsum producing unexpected NA)
将NA yearqtr转换为动物园中的字符串:可能的错误?(Conversion of NA yearqtr to string in zoo: possible bug?)
NA在`i`表达data.table(可能的bug)[重复](NA in `i` expression of data.table (possible bug) [duplicate])
相关文章
更多Node.js视频教程
《MLDN出品 魔乐科技Node.JS + MongoDB(JSP、HTML 、XML、JavaScript、Servlet、Struts、Ajax)视频汇总》(Node.JS + MongoDB\JSP、HTML 、XML、JavaScript、Servlet、Struts、Ajax nodejs)V2013[压缩包]
java server怎样和c++ client实现SSL通信??
了解 https ssl数字证书,关注 GlobalSign 微信,拿优盘
了解 https ssl数字证书,关注 GlobalSign 微信,拿优盘
Hadoop Backup Node
Hadoop node 部署步骤
社区版Federated HDFS(多Name Node)实现浅析
Hadoop 解除 “Name node is in safe mode”
Hadoop 解除 “Name node is in safe mode”
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!