A CentOS 7 server hosts a public front end web site at example.com, and also hosts a backend API at home.example.com. The VirtualHost records below successfully direct requests for example.com to the front end while directing requests for the backend to home.example.com. However, requests for arbitrary requests to paths on example.com are given 404 errors.
What specific changes need to be made to the
VirtualHostconfig below so that requests toexample.com/anyPath getredirected to example.com?
For example, a request for http://example.com/home that reaches the server should be returned with example.com
Here is the VirtualHost:
<VirtualHost www.example.com:80> ServerName www.example.com ServerAlias example.com ErrorLog /var/log/httpd/example_com_error.log CustomLog /var/log/httpd/example_com_requests.log combined DocumentRoot /var/www/example/public_html </VirtualHost> <VirtualHost home.example.com:80> ServerName home.example.com ErrorLog /var/log/httpd/example_home_com_error.log CustomLog /var/log/httpd/example_home_com_requests.log combined ProxyPass / http://public.ip.for.api:1234/ connectiontimeout=5 timeout=30 </VirtualHost>