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.

I'm trying to setup a redirect to https on a specific ServerName but before it does the redirect I'd like it to match a Location path and reverse proxy to a separate server rather than redirect to the https URL. Below is how I thought it would work but it seems that it redirects before doing the reverse proxy. Clearly my apache skills are lacking. Maybe, I need two separate VirtualHosts? Any help would be appreciated.

<VirtualHost *:80>
    ServerName domain.com
    <Location /console>
        ProxyPass http://internal.server.com:8000/console
        ProxyPassReverse http://internal.server.com:8000/console
    </Location>
    <Location />
        Redirect permanent / https://internal.server2.com
    </Location>
</VirtualHost>
share|improve this question
    
Do you want the Redirect to happen for everything not in /console, then? Or just for the / location? –  Shane Madden May 24 '13 at 2:15
    
Redirect everything that isn't /console. To add to that if it is /console reverse proxy to web application console aka Weblogic console. –  Gareth May 24 '13 at 8:15

1 Answer 1

up vote 0 down vote accepted

Instead of letting the Redirect config apply for all locations, let's avoid applying it for /console. Remove the <Location /> section and replace it with:

<LocationMatch "!^/console">
    Redirect permanent / https://internal.server2.com/
</LocationMatch>
share|improve this answer
    
So you are saying I can do this? <VirtualHost *:80> ServerName domain.com <Location /console> ProxyPass internal.server.com:8000/console ProxyPassReverse internal.server.com:8000/console </Location> <LocationMatch "!^/console"> Redirect permanent / internal.server2.com </LocationMatch> </VirtualHost> Stupid comments don't handle formatting well. –  Gareth May 28 '13 at 14:10
    
@Gareth Right, that should have the Redirect take effect for all locations that aren't /console –  Shane Madden May 28 '13 at 21:55

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.