【发布时间】:2017-03-01 10:56:11
【问题描述】:
我想在我的 nodejs 应用程序上添加安全性。
为此,我添加了一个带有 apache 的 proxyReverse 来使用 apache 访问我的节点应用程序。 它正在工作,但问题是我仍然能够在不通过 apache 的情况下访问我的节点应用程序...
我的节点站点位于 mydomain:8080/html/site.html 我在 mydomain/site 上使用 apache 访问节点
所以我想要的是将 mydomain:8080/html/site.html 重定向到 mydomain/site ...
但我害怕打无限电话。
这是我的节点server.js:
var express = require('express');
var port = 8080;
/*------------------------
Configuration
------------------------*/
app = express();
app.use(express.static('public'));
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
/* Port d'ecoute du serveur */
app.listen(port);
这是我的 apache2.conf:
<VirtualHost 172.30.0.10:80 >
ServerName "mydomain:80"
UseCanonicalName Off
ProxyPass /site http://mydomain:8080/html/site.html
ProxyPassReverse /site http://mydomain:8080/html/site.html
<Proxy *>
Order deny,allow
Allow from all
Authtype Basic
Authname "Password Required"
AuthUserFile /etc/apache2/passwords
Require valid-user
</Proxy>
</VirtualHost>
我需要你的帮助和建议!提前感谢您阅读本文!
【问题讨论】:
-
你有任何答案吗???
标签: angularjs node.js apache security reverse-proxy