基于http方法的Apache限制proxypass
我对apache非常陌生,我有两个服务,一个用于读取,一个用于写入,两个服务支持相同的位置。但这条路线似乎不起作用。我是否可以基于Http方法限制这些基于http方法的Apache限制proxypass,apache,Apache,我对apache非常陌生,我有两个服务,一个用于读取,一个用于写入,两个服务支持相同的位置。但这条路线似乎不起作用。我是否可以基于Http方法限制这些 <VirtualHost *:1000> ServerAdmin me@example.com DocumentRoot "C:/Apache24/htdocs" ServerName localhost:1000 ErrorLog "logs/example.c
<VirtualHost *:1000>
ServerAdmin me@example.com
DocumentRoot "C:/Apache24/htdocs"
ServerName localhost:1000
ErrorLog "logs/example.com-error.log"
CustomLog "logs/example.com-access.log" common
ForensicLog "logs/forensic-log.log"
ProxyRequests Off
ProxyPreserveHost On
LogLevel debug
<Proxy *>
Require all granted
</Proxy>
#ReadService only supports GET
<Location /api/users>
ProxyPass http://localhost:5000/api/users connectiontimeout=5 timeout=300
ProxyPassReverse hhttp://localhost:5000/api/calls
</Location>
#WriteService anything other than GET
<Location /api/users>
ProxyPass http://localhost:7000/api/users connectiontimeout=5 timeout=300
ProxyPassReverse http://localhost:7000/api/users
</Location>
</VirtualHost>
服务器管理员me@example.com
DocumentRoot“C:/Apache24/htdocs”
ServerName本地主机:1000
ErrorLog“logs/example.com error.log”
CustomLog“logs/example.com access.log”通用
取证封锁“日志/取证日志.日志”
代理请求关闭
代理主机
日志级调试
要求所有授权
#ReadService仅支持GET
ProxyPasshttp://localhost:5000/api/users connectiontimeout=5超时=300
ProxyPassReversehhttp://localhost:5000/api/calls
#WriteService除了GET之外的任何内容
ProxyPasshttp://localhost:7000/api/users connectiontimeout=5超时=300
ProxyPassReversehttp://localhost:7000/api/users
尝试添加一个限制,但我收到一个错误,表示虚拟主机中不允许使用该限制
RewriteCond %{REQUEST_METHOD} ^(GET)$
RewriteCond %{REQUEST_URI} ^/api/users(.*)$
RewriteRule ^/api/users(.*)$ http://localhost:5000/api/users$1 [P]
RewriteCond %{REQUEST_METHOD} !^(GET)$
RewriteCond %{REQUEST_URI} ^/api/users(.*)$
RewriteRule ^/api/users(.*)$ http://localhost:7000/api/users$1 [P]