문제

I have multiple urls coming into a server. I want to user host headers to redirect the traffic. I am trying to use Apache to redirect these requests to various servers that are inside our firewall. I have gotten part of the solution, but, I seem to be missing something.

For example, http://hostHeader1.mycompany.com should be redirected to a server inside our firewall that handles requests for hostHeader1, and the result should be handed back to the client. http://hostHeader2.mycompany.com should be redirected to a server inside our firewall that handles requests for hostHeader2. Etc.

Right now, I have the following, but, it redirects all traffic to http://hostHeader1Handler/:

<VirtualHost *:*>
ProxyPreserveHost On
ProxyPass / http://hostHeader1Handler/
ProxyPassReverse / http://hostHeader1Handler/
ServerName hostHeader1.mycompany.com
</VirtualHost> 

Any help appreciated.

Scott

도움이 되었습니까?

해결책

This is probably your first or your only virtual host. Just add another virtual host before. Then this should be the new default.

NameVirtualHost *:*
<VirtualHost *:*>
    ServerName your.default.domain.de
DocumentRoot /var/www/pathToHTML
</VirtualHost>

<VirtualHost *:*>
    ProxyPreserveHost On
    ProxyPass / http://hostHeader1Handler/
    ProxyPassReverse / http://hostHeader1Handler/
    ServerName hostHeader1.mycompany.com
</VirtualHost> 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top