[英]Apache mod_proxy and Node Express renders plain text
I am running a webserver with Apache 2.2.12 as default webserver bound to port 80. For a new project I need to proxy one of Apaches bound domains via port 80 to a Node Express Server 4.7 which runs on the same machine on port 4000. 我正在运行将Apache 2.2.12作为绑定到端口80的默认Web服务器的Web服务器。对于一个新项目,我需要通过端口80将Apache绑定的域之一代理到Node Express Server 4.7,该节点在端口4000上的同一台计算机上运行。
The Express process served alone is running fine with expected results. 单独提供的Express流程运行良好,并取得了预期的结果。 Means, when I visit my-domain.com:4000 everything looks good.
就是说,当我访问my-domain.com:4000时,一切看起来都很好。
Ok, so I set up a virtual host in Apache which should proxy my-domain.com to the Express server on port 4000. 好的,所以我在Apache中设置了一个虚拟主机,该主机应将my-domain.com代理到端口4000上的Express服务器。
I have tried proxying to localhost:4000 or my-domain.com:4000 but Apache is always rendering the Express response as plain text not as real HTML. 我尝试代理到localhost:4000或my-domain.com:4000,但是Apache始终将Express响应呈现为纯文本,而不是真实的HTML。 This means I see the HTML-String inside my browser instead of the parsed website.
这意味着我在浏览器中看到的是HTML-String,而不是解析后的网站。 The Browser just echos the Express string inside its own html-wrapper nested in a pre-tag when you explore the source code via inspector.
当您通过检查器浏览源代码时,浏览器只是在嵌套在预标签中的自己的html-wrapper中回显Express字符串。
My Apache-Config looks like this: 我的Apache-Config看起来像这样:
<VirtualHost *:80>
ServerName my-domain.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:4000/
ProxyPassReverse / http://locahost:4000/
</VirtualHost>
Any help or suggestions would be appreciated. 任何帮助或建议,将不胜感激。 Thx.
谢谢。
Found the parameter inside apache2.conf 在apache2.conf中找到参数
setting: 设置:
DefaultType text/plain
to 至
DefaultType text/html
worked out. 解决了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.