Redirect order

Discussion in 'Apache' started by Tsaby, Nov 24, 2010.

  1. #1
    Hi @ll,

    I have a little issue on one Apache/2.0.52 server. The problem is that
    there were some applications which were served by a Tomcat connector
    (with jk_mod).
    After this we had to implement a new ProxyPass to point "/" to a
    Windows IIS SharePoint server.

    The SharePoint server use HTTP authentication. The problem is occurred
    when the user first visit and authenticate on https://localhost then
    navigate to another application https://localhost/app1 (one which
    served by Tomcat) they get an HTTP 401 code.

    I assume that the browsers forward the authentication credentials to
    the Tomcat server which cannot interpret it.

    Current configuration (server1.com -> apache server, server2.com ->
    SharePoint server)

    HTTP Virtulal host config:

    <VirtualHost server1.com:80>
    ProxyPass /app1 !
    RedirectPermanent /app1 https://server1.com/app1

    ProxyPass /app2 !
    RedirectPermanent /app2 https://server1.com/app2

    ProxyPass /app3 http://server2.com
    ProxyPassReverse /app3 http://server2.com

    RedirectPermanent / https://server2.com/
    </VirtualHost>

    =======================================

    HTTPS Virtual host config:

    <VirtualHost server1.com:443>
    ProxyPass /app1 !
    JkMount /app1 app1
    JkMount /app1/* app1

    ProxyPass /app2 !
    JkMount /app2 app2
    JkMount /app2/* app2

    ProxyPass /app3 http://server2.com
    ProxyPassReverse /app3 http://server2.com

    ProxyPass / http://server2.com/
    ProxyPassReverse / http://server2.com/
    </VirtualHost>

    =======================================

    As a solution we want to separate this configurations. One part would
    be dedicated only for the SharePoint server => sp.server1.com, and the
    other one would serve the Tomcat applications and redirect everything
    else to sp.server1.com.

    What I don't know is how should I configure a redirect to serve all
    /app1 & /app2 & /app3, but redirect all other request to the other
    Virtual Host which take care about the SharePoint.
    Basicly I don't know which directive is the "stronger" ProxyPass or
    Redirect or JkMount

    In the above mentioned config I would modify the:
    ProxyPass / http://server2.com/
    ProxyPassReverse / http://server2.com/
    lines to:
    RedirectPermanent / http://sp.server1.com/

    but I fear that this Redirect would override all the other application
    directive.

    All tips are warmly welcome!

    Thanks in advance!
     
    Tsaby, Nov 24, 2010 IP