Forum Moderators: phranque

Message Too Old, No Replies

ProxyPass

No proxy for a subdomain

         

aimless

9:57 am on Mar 22, 2010 (gmt 0)

10+ Year Member



I have a site say http://www.example.com which is running on tomcat proxied via apache.

Mapping is something like

<Location /pay/>
ProxyPass ajp://localhost:8009/pay/
ProxyPassReverse ajp://localhost:8009/pay/
</Location>

<LocationMatch />
ProxyPass ajp://localhost:8009/
ProxyPassReverse ajp://localhost:8009/
</LocationMatch>

Now I created a virtual host called static.example.com
<VirtualHost *:80>
ServerName static.example.com
ServerAlias static.example.com static
DocumentRoot /opt/apache/current/htdocs/example
ScriptAlias /cgi-bin/ /opt/apache/current/cgi-bin/
<Directory /opt/apache/current/htdocs/example>
Order allow,deny
Allow from all
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /opt/apache/current/cgi-bin>
Order allow,deny
Allow from all
Options None
AllowOverride None
</Directory>
</VirtualHost>


Now when I do [static.example.com...] it opens content of http://example.com. But when I comment out LocationMatch / proxy mapping like

#<LocationMatch />
# ProxyPass ajp://localhost:8009/
# ProxyPassReverse ajp://localhost:8009/
#</LocationMatch>

correct page from static.example.com is displayed. So it means I have to bypass proxy for static.example.com.
I tried
ProxyPass static.example.com !

but it doesn't seem to be working. Can anyone help.

jdMorgan

5:07 pm on Mar 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's impossible to form an opinion or make recommendations without seeing the vHost setup for example.com itself. It's likely that the scope of your ProxyPass and ProxyPassReverse directives are incorrect (i.e. not in the right location and/or section containers) and are therefore being applied to both hostnames, but it's not possible to say for sure with the info provided.

Jim

[edited by: jdMorgan at 11:53 am (utc) on Mar 23, 2010]

aimless

8:13 pm on Mar 22, 2010 (gmt 0)

10+ Year Member



Thanx Jim .. indirectly you give me hint to solve the problem. I moved
<Location /pay/>
ProxyPass ajp://localhost:8009/pay/
ProxyPassReverse ajp://localhost:8009/pay/
</Location>

<LocationMatch />
ProxyPass ajp://localhost:8009/
ProxyPassReverse ajp://localhost:8009/
</LocationMatch>

to default virtal host like

<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot /opt/apache/current/htdocs
ServerName example.com

<Location /pay/>
ProxyPass ajp://localhost:8009/pay/
ProxyPassReverse ajp://localhost:8009/pay/
</Location>

<LocationMatch />
ProxyPass ajp://localhost:8009/
ProxyPassReverse ajp://localhost:8009/
</LocationMatch>
</VirtualHost>

And secondly virtual host remains same

<VirtualHost *:80>
ServerName static.example.com
ServerAlias static.example.com static
DocumentRoot /opt/apache/current/htdocs/example
ScriptAlias /cgi-bin/ /opt/apache/current/cgi-bin/
<Directory /opt/apache/current/htdocs/example>
Order allow,deny
Allow from all
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /opt/apache/current/cgi-bin>
Order allow,deny
Allow from all
Options None
AllowOverride None
</Directory>
</VirtualHost>

My point of mistake was scope of ProxyPass. Again thanx a lot for your help