LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache URL rewriting (http://www.linuxquestions.org/questions/linux-server-73/apache-url-rewriting-4175457461/)

linuxlover.chaitanya 04-09-2013 03:07 AM

Apache URL rewriting
 
Hello all,

We have a requirement where we need forward a internal URL to external HTTPS link. This HTTPS link is our exchange outlook web access. I have tried ReverseProxy and URL rewrite and redirect. Though the redirection is working in these cases, the URL on the client end browser changes to the original which is not what I want.

This is what I tried:

Code:


ProxyPass /app1/ https://<our-link>/owa/
ProxyPassReverse /app1/ https://<our-link>/owa/

<Location ~ "^/(app1/)">
        SSLRequireSSL
</Location>

This actually redirects the /app1/ but the original URL is visible on the client browser.

and

Code:

RewriteEngine on
RewriteRule ^/app1/(.+) https://<our-link>/owa/$1 [R,L]

This does not work at all. But I find this method promising as the error I get is /app1/ not found on the server.

Is there any way of doing what I want to?

vishesh 04-10-2013 12:57 PM

Can you try with

RewriteRule ^/app1/([A-Z_a-z\.?&=]*)$ https://<our-link>/owa/$1 [R=301]

As it seems that GET or POST data not getting passed correctly.

Thanks

linuxlover.chaitanya 04-13-2013 07:22 AM

Does not seem to be working the way I want it to. The client URL still changes to the redirected one.

linuxlover.chaitanya 04-14-2013 01:27 AM

I seem to have got ahead with something but not working exactly I would like it to be.
Following is the configuration that has got me some further not to the destination though.

Code:

<VirtualHost 10.10.8.175:443>
        ServerName 10.10.8.175:443
        SSLEngine On
        SSLProxyEngine On
        SSLCertificateFile /etc/pki/tls/certs/localhost.crt
        SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

        ProxyPass /app1/ https://<our-link>/owa/
        ProxyPassReverse /app1/ https://<our-link>/owa/

        <Location ~ "^/(app1/)">
                SSLRequireSSL
        </Location>


        ProxyPass /app2/ http://www.ourdomain.com/
        ProxyPassReverse /app2/ http://www.ourdomain.com/

        <Location ~ "^/(app2/)">
                SSLRequireSSL
        </Location>
</VirtualHost>

The /app2/ works for me but /app1/ does not. I get only a blank page.

Following is the error I see in the logs for /app1/

Code:

File does not exist: /var/www/html/owa, referer: https://10.10.8.175/app1/auth/logon.aspx?url=https://<our-link>/owa/&reason=0
I dont understand why it is referring to the local file when it is configured to only refer the exchange web access link.

Any help would be much appreciated.

linuxlover.chaitanya 05-07-2013 04:42 AM

Resolved the issue by just changing the Virtual Directory to /owa/. Strange but true.


All times are GMT -5. The time now is 06:13 AM.