Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We're using Apache as a frontend to our web application servers. Apache serves all requests and forwards these requests to the correct application server based on the request URL.

We want to preserve the existing Location-mappings for our single VirtualHost, but forward all other requests to one of the application server for further processing, i.e. we want Apache to forward all requests that do not match any of the existing Location-mappings to a single server. I've tried the following

<VirtualHost *:443>
    # Global settings for virtual host
    ...
    # New "fallback" Location mapping
    <Location />
       ...
    </Location>

    # Existing Location mappings
    <Location /portal>
       ...
    </Location>
    ...
</VirtualHost>

But then Apache forwards all requests to the fallback server. Is there any way to properly specify such a "fallback" Location and still allow existing mappings to function properly?

share|improve this question

3 Answers 3

Apache reads its config file in a natural way.

Try putting your fallback a bottom of httpd.conf

share|improve this answer
    
Thanks for your response. I have tried defining the '/' Location both at the top of the VirtualHost-definition and at the bottom. It does not appear to make any difference. Perhaps there is a configuration option to specify how Apache should treat/read/interprit the Location-mappings wrt. the ambiguity that occurs, e.g. most specific or least specific? We're running Apache 2.0 –  vingrisen Sep 28 '09 at 14:36

I'm not sure if this will work, but you could try pointing the 404 error document to the fallback location.

ErrorDocument 404 /
share|improve this answer
    
wouldn't this still return the HTTP error code to the browser? if so, may negatively impact your SEO –  Roy Rico Sep 28 '09 at 20:16
    
@Roy Rico: Unfortunately, yes. –  Powerlord Sep 28 '09 at 20:24

I think you could put your directives outside of the directive

NOTE: i'm not at a place where i have access to my apache server to test right now1

<VirtualHost *:443>
    # Global settings for virtual host
    ...

    # New "fallback" Location mapping
    ...

    # Existing Location mappings
    <Location /portal>
       ...
    </Location>

    # Other Settings
    ...
</VirtualHost>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.