Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been looking around in Google and so far have not found a page that addresses my situation, which is weird because I'm sure it's been attempted thousands, if not millions, of times before.

I want to host development sites from my home for clients to test before we deploy them to whatever kind of hosting solution they want for production. Here is what I am using:

  • a dynamic dns service ($$ per year vs $$ per month for a fixed IP) - we'll call it
  • the so-called "forwarding with masking" provided for free by my domain's registrar to forward specific subdomains to unique ports at the dynamic dns domain name - eg goes to, goes to, etc...
  • port forwarding on my router to forward each of the unique ports to its own IP on my private LAN - eg 8081 to, 8082 to, etc...
  • virtual interfaces with a range if IP's using ifcfg-eth0-range0
  • multiple Listen directives in httpd.conf for IP-based virtual hosts

All this has been working great, but now I want to use https for all of my subdomains, so I bought a wildcard certificate (believe it or not, the cert plus the dynamic dns works out to be anywhere from 36% to 41% cheaper than the monthly rate my ISP charges for one fixed IP), and I have installed it successfully using the appropriate SSLCertificate* directives in the VirtualHost tags.

The trouble is that the browser is complaining about an untrusted connection because despite the so-called "masking" it still realizes that it is being redirected through the dynamic dns domain. uses an invalid security certificate.

    The certificate is only valid for the following names:
    * ,  

    (Error code: ssl_error_bad_cert_domain)

I thought I could use some mod_rewrite directives, but either I haven't found the correct combination of RewriteCond and RewriteRule patterns and flags, or I am misunderstanding what is going on with the "forwarding with masking".

    RewriteEngine on
    RewriteCond %{HTTP_HOST} [NC]
    RewriteRule ^(.*)$1 [P]

Can someone explain how to make this work?

share|improve this question
up vote 1 down vote accepted

In short, this won't work.

Your dynamic DNS provider is responding with HTTP redirects from to address; this is the only way you can redirect based on the HTTP Host header and change the port number at the same time.

The only way I can think of is to CNAME to and setup a reverse proxy to server traffic from the proper dev server.

This way, when your client (Acme Incorporated) fires up, DNS will resolve directly to your dynamic IP (via the CNAME) and your Reverse Proxy will see the Host Header as "". It can then go to to obtain the relevant content.

share|improve this answer
THANKS :-) The CNAME idea worked, however since I want to keep the nonstandard port in order to cut down on bot probes, what I did was CNAME and then changed the forwarding of to <>; – Jeff Apr 15 '13 at 6:50
there was supposed to be an https : // in front of homeserver but the evil comment editor would not let me change it after 5 minutes :-P – Jeff Apr 15 '13 at 6:56

Your Answer


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.