I'm running CentOS on 3 servers. Server A runs my apache web server. Server B and C run other servers on different ports. I'm trying to get htt://serverA/math/ to proxy to htt://serverB:8765/ but I'm getting errors I can't seem to fix. Here is my entry into the httpd.conf file:
RewriteEngine On
RewriteRule ^math/(.*)$ http://serverB:8765/$1 [P]
I get the following error in my log:
[error] [client xx.xx.xx.xx] File does not exist: /var/www/html/math
If I change the httpd.conf to this:
RewriteEngine On
RewriteRule ^/(.*)$ http://serverB:8765/$1 [P]
All traffic to server A is redirected properly to server B, so I know that mod_rewrite and mod_proxy are working.
Can anyone point me in the right direction? Thanks.
I think your rule should be:
Since it's not matched, you get the error messages
katriel is right but you could also use the ProxyPass/ProxyPassReverse directive. See this. It's design to do what you want in a much simple way.
Example:
radius is right--you're better off using the actual proxy directives. Something like this should work:
The error that you're getting may be because you're proxying ".../math/" but not ".../math".