LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Reverse proxy rewrite http problem (https://www.linuxquestions.org/questions/linux-server-73/reverse-proxy-rewrite-http-problem-935070/)

polishpt 03-18-2012 06:33 AM

Reverse proxy rewrite http problem
 
Hi,
first of all I want to say hi as I'm new here.

I need your help. I'm having problems with reverse proxy rewriting to https:

I have an alfresco app running on top of tomcat and as a front and an Apache server - it's site-enabled looks like that:

Code:

<VirtualHost *:80>
        ServerName alfresco

        JkMount /* ajp13_worker


        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
        ServerSignature Off
</VirtualHost>

I also have a reverse proxy server running on second machine and i want it to rewrite queries to https. It's site-enabled looks like that:

Code:

<VirtualHost 192.168.251.50:80>
        ServerName alfresco

        DocumentRoot /var/www/


        RewriteEngine on
        RewriteRule (.*) https://alfresco/  [R]

        LogLevel warn
        ErrorLog  /var/log/apache2/alfresco-80-error.log
        CustomLog /var/log/apache2/alfresco-80-access.log combined
        ServerSignature Off
</VirtualHost>


<VirtualHost 192.168.251.50:443>
        ServerName alfresco

        DocumentRoot /var/www/

        SSLEngine On
        SSLProxyEngine On
        SSLCertificateFile      /etc/ssl/certs/alfresco.pem
        SSLCertificateKeyFile  /etc/ssl/private/alfresco.key

        SetEnvIf User-Agent ".*MSIE.*"  nokeepalive ssl-unclean-shutdown \
                                        downgrade-1.0 force-response-1.0

        ProxyRequests Off
        ProxyPreserveHost On

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>
 
        ProxyPass /alfresco      http://192.168.251.50:8080/alfresco
        ProxyPassReverse /alfresco http://192.168.251.50:8080/alfresco

        LogLevel warn
        ErrorLog /var/log/apache2/alfresco-443-error.log
        CustomLog /var/log/apache2/alfresco-443-access.log combined
        ServerSignature Off
</VirtualHost>

Now, ProxyPass works, when I go to alfresco/alfrsco in a browser application opens, but rewriting to https doesn't work.

Plese help.

Regards

bathory 03-19-2012 06:07 PM

Hi and welcome to LQ,
Quote:

Now, ProxyPass works, when I go to alfresco/alfrsco in a browser application opens, but rewriting to https doesn't work.
What do you mean by that? Does http://alfresco goes to https://alfresco? It should as your rewrite looks ok.
Maybe you want to use:
Code:

RewriteRule (.*) https://alfresco%{REQUEST_URI} [R]
so http://alfresco/alfresco rewrites to https://alfresco/alfresco

Regards


All times are GMT -5. The time now is 08:24 AM.