Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 使用Node/Express将http重定向到https_Node.js_Ssl_Express_Https_Parse Platform - Fatal编程技术网

Node.js 使用Node/Express将http重定向到https

Node.js 使用Node/Express将http重定向到https,node.js,ssl,express,https,parse-platform,Node.js,Ssl,Express,Https,Parse Platform,我有一个Parse.com托管的网站。它在Node.js/Express.js 3上运行。如果有人使用http访问域,我只是试图强制使用https。可能吗 他们有一些文档,但我不确定如何应用: 它准确地描述了如何在该页面上使用它: 要使用此中间件,您必须从JavaScript文件中要求它: var parseExpressHttpsRedirect=require('parse-express-https-redirect') 然后,您可以使用中间件将所有请求重定向到HTTPS 使用(parse

我有一个Parse.com托管的网站。它在Node.js/Express.js 3上运行。如果有人使用http访问域,我只是试图强制使用https。可能吗

他们有一些文档,但我不确定如何应用:
它准确地描述了如何在该页面上使用它:

要使用此中间件,您必须从JavaScript文件中要求它:

var parseExpressHttpsRedirect=require('parse-express-https-redirect')

然后,您可以使用中间件将所有请求重定向到HTTPS

使用(parseExpressHttpsRedirect())

因此,在代码中:

var parseExpressHttpsRedirect = require('parse-express-https-redirect');

// ... later on when you're initializing your express app ...
app.use(parseExpressHttpsRedirect());

它准确地描述了如何在该页面上使用它:

要使用此中间件,您必须从JavaScript文件中要求它:

var parseExpressHttpsRedirect=require('parse-express-https-redirect')

然后,您可以使用中间件将所有请求重定向到HTTPS

使用(parseExpressHttpsRedirect())

因此,在代码中:

var parseExpressHttpsRedirect = require('parse-express-https-redirect');

// ... later on when you're initializing your express app ...
app.use(parseExpressHttpsRedirect());

它准确地描述了如何在该页面上使用它:

要使用此中间件,您必须从JavaScript文件中要求它:

var parseExpressHttpsRedirect=require('parse-express-https-redirect')

然后,您可以使用中间件将所有请求重定向到HTTPS

使用(parseExpressHttpsRedirect())

因此,在代码中:

var parseExpressHttpsRedirect = require('parse-express-https-redirect');

// ... later on when you're initializing your express app ...
app.use(parseExpressHttpsRedirect());

它准确地描述了如何在该页面上使用它:

要使用此中间件,您必须从JavaScript文件中要求它:

var parseExpressHttpsRedirect=require('parse-express-https-redirect')

然后,您可以使用中间件将所有请求重定向到HTTPS

使用(parseExpressHttpsRedirect())

因此,在代码中:

var parseExpressHttpsRedirect = require('parse-express-https-redirect');

// ... later on when you're initializing your express app ...
app.use(parseExpressHttpsRedirect());

你说得对!问题是我部署到了错误的应用程序!哦!六羟甲基三聚氰胺六甲醚。。。所以这个特定的应用程序不运行Express。这只是一个静态网站。因此app.js似乎没有做任何工作。如何为静态网站提供服务来实现这一点?啊,这意味着您没有使用Node.js/Express来提供文件。它是什么Web服务器?Apache/IIS/nginx/等?它由Parse.com托管您是对的!问题是我部署到了错误的应用程序!哦!六羟甲基三聚氰胺六甲醚。。。所以这个特定的应用程序不运行Express。这只是一个静态网站。因此app.js似乎没有做任何工作。如何为静态网站提供服务来实现这一点?啊,这意味着您没有使用Node.js/Express来提供文件。它是什么Web服务器?Apache/IIS/nginx/等?它由Parse.com托管您是对的!问题是我部署到了错误的应用程序!哦!六羟甲基三聚氰胺六甲醚。。。所以这个特定的应用程序不运行Express。这只是一个静态网站。因此app.js似乎没有做任何工作。如何为静态网站提供服务来实现这一点?啊,这意味着您没有使用Node.js/Express来提供文件。它是什么Web服务器?Apache/IIS/nginx/等?它由Parse.com托管您是对的!问题是我部署到了错误的应用程序!哦!六羟甲基三聚氰胺六甲醚。。。所以这个特定的应用程序不运行Express。这只是一个静态网站。因此app.js似乎没有做任何工作。如何为静态网站提供服务来实现这一点?啊,这意味着您没有使用Node.js/Express来提供文件。它是什么Web服务器?Apache/IIS/nginx/等?它由Parse.com托管