【发布时间】:2013-08-23 19:18:26
【问题描述】:
我的 node-reverse-proxy 设置如下:
var options = {
pathnameOnly: true,
router: {
'/myapp': '127.0.0.1:9000',
}
}
httpProxy.createServer(options).listen(8000);
9000 根目录下的 webapp 有一个 index.html 文件,其中有一个像这样的 stylesheet 链接:
<link rel="stylesheet" href="styles/blue.css">
当我直接点击 localhost:9000 时,会加载 html 并找到 css。然后我通过 localhost:8000/myapp 的反向代理访问它,但是我得到一个 Error 404 因为 localhost:9000/未找到样式/blue.css,因为该文件显然是在 localhost:9000/myapp/styles/blue.css 上提供的。
我的应用程序的 html 当然不知道反向代理,所以我无法在 index.html 中解决这个问题。所以我想我错过了一些关于代理设置的基本知识??
【问题讨论】:
标签: node.js reverse-proxy nodejitsu