admin管理员组文章数量:1406154
I have an apache server that is reachable from outside my local network, named interfaceserver
.
I also have an express server in my local network, named localserver
.
In apache configuration of interfaceserver
, I am proxying routes starting with foo
to localserver
, with the following lines in the conf:
ProxyPass "/foo" "http://localserver:8001/foo"
ProxyPassReverse "/foo" "http://localserver:8001/foo"
localserver
is serving static files in his public
directory. This is the architecture of localserver
:
/srv/localserver
├── public # folder containing static files
├── routes # folder containing routes
├── app.js
In app.js
, I am serving static files with:
app.use(express.static("public"));
Static files are served well when I am accessing http://localserver:8001/foo
, but they are not served at all when accessing via , error 404.
I can't store the static files in interfaceserver
.
I am using the static files in my ejs
file. For example:
<link href="/css/main.css" rel="stylesheet" type="text/css">
本文标签: nodejsserving static files with a proxy serverStack Overflow
版权声明:本文标题:node.js - serving static files with a proxy server - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744355278a2602274.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论