【发布时间】:2016-09-27 12:07:51
【问题描述】:
我有一个监听 80 端口的 apache 网络服务器。使用 apache,一个基于 Zend 框架的 PHP/MySQL 系统。而且我还有一个节点服务器正在监听 3000 端口。
当客户端发送请求时,总是在端口 80 上,因此它首先由 apache 处理。我想在处理请求之前应用以下规则:
if content-type is "application/json" then
use apache web server
else if content-type is "application/zend" then
use apache web server
else
use node server
这里 content-type 在请求头中发送。 Content-type "application/zend" 是一个自定义的 content-type 表示,对于这种类型的特定请求,我们不想使用节点服务器(出于某些原因我需要它)。
我尝试使用
修改 httpd-vhosts.confProxyPreserveHost on
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
但这当然还不够,因为并非所有事情都应该由节点服务器处理(侦听端口 3000)。因此应该添加一些规则。但我不确定在哪里/如何。我也尝试更改 .htaccess 文件,但也不确定如何更改。
任何帮助都会很棒!谢谢!
【问题讨论】:
-
什么是apache版本
-
嗨!版本为 Apache/2.4.18
标签: node.js apache .htaccess content-type mod-proxy