I have a *:80 virtual host in Apache 2.2.15 which is just a bunch of URL rewrites like:

ServerAlias foo.bar biz.baz tit.tat
RewriteRule / http://somesite.com (R=301,L)

ServerAlias differentsite.com example.it
RewriteRule ....

I want to do a masked URL rewrite so babysnakes.com goes to https://dancingfool.com/moms.php

I tried using mod_rewrite with P flag and I tried mod_proxy and then realized it doesn't handle SSL proxying, that mod_ssl should handle. What I am not clear on is whether I can do SSLProxyEngine in a non SSL vhost config (no certs defined etc).

  • In your example, there is no redirect to a HTTPS, is this just a typo? Jul 24 '14 at 18:54
  • No, my example just shows what the rest of the conf file looks like, but you can assume that I would basically like to use that syntax if possible, but with the destination being HTTPS, this is what I am having trouble with. Jul 24 '14 at 19:13
  • Are you wanting to Proxy (transparent) or do a 301 redirect? A 301 redirect will change the URL. Jul 25 '14 at 16:03
  • Proxy is fine, I just want a masked URL rewrite, whatever works. Jul 25 '14 at 16:15
  • Just to point out that this is generally a terrible idea. Most sites enable SSL to protect their users. By doing so, you're effectively downgrading the level of security they have when accessing that site.
    – Bruno
    Jul 31 '14 at 15:44

You may need to use SSLProxyEngine On to make the proxy work via SSL.

RewriteEngine On
SSLProxyEngine On
RewriteCond %{HTTP_HOST} ^babysnakes.com$ [NC]
RewriteRule ^/$ https://dancingfool.com/moms.php [P,L]

I did a quick test of proxy requests to an SSL page using the [P] flag and it worked for me. (different domains though)

  • Don't forget SSLProxyCheckPeerName on (and other SSLProxyCheck* directives) if it's not enabled by default in your version (e.g. Apache 2.2), even if the whole idea isn't really secure anyway.
    – Bruno
    Jul 31 '14 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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