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 have a http service running on 10.1.1.187:8080.

This is delivered as a public https service to https://public.example.com which is 10.1.1.186:443 via apache proxy magic:

<VirtualHost 10.1.1.186:443>
    ServerName public.example.com

    #Configure Reverse Proxy
    ProxyRequests Off
    ProxyPreserveHost On

    <Location />
        ProxyPass http://10.1.1.187:8080/
        ProxyPassReverse http://10.1.1.187:8080/

        Order allow,deny
        Allow from all
    </Location>

    #Define Virtual Host Specific SSL information.
    SSLEngine On
    SSLProxyEngine On
    SSLProxyProtocol all -SSLv2

    SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

</VirtualHost>

When I enter https://public.example.com in my browser and click through the certificate, I can get the first page which contains a login form:

<form action="http://public.example.com/login" method="post">
  <--  ... contains username, password fields and a send button -->
</form>

So the action target was very nice rewritten. But the http should read https. How to do that?

It would be nice if the link was changed in the form action tag, pointing to the correct https page already, rather using a second http virtual host with a rewrite condition.

Edit:

This is the additional part that solved it (I put it in the vhost but outside the Location container):

SetOutputFilter proxy-html

# On: rewrite also css and javascript - Off: only in HTML
ProxyHTMLExtended Off
# Maybe this should be switched on

ProxyHTMLURLMap http://public.example.com https://public.example.com
share|improve this question

1 Answer 1

up vote 2 down vote accepted

You might try http://apache.webthing.com/mod_proxy_html/. It's intended to rewrite URLs in a "proxy situation".

share|improve this answer
    
I solved it with your help. Thank you. –  mit Oct 18 '10 at 20:11

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.