Meteor app with mupx using SSL and port forward just doesn't work

I have the following configuration:

  • Deploying a meteor app with mupx to a digital ocean droplet running Ubuntu
  • I’m using Apache on the droplet which is also running Wordpress
  • The meteor app is deployed to a subdomain and using SSL

I am using a proxy to forward the meteor app from a normal http domain to an https domain with a special port (8011).

I can access the main domain with http (wordpress). I can access the meteor app directly as this:

https://appx.xxxxx.com:8011

But the forward proxy does not work, so if I try to access:

https://appx.domain.com

It gives me an error related to the certificate I am using:

appx.xxxxx.com uses an invalid security certificate. The certificate is only valid for xxxxx.com (Error code: ssl_error_bad_cert_domain)

This is not correct. The certificate is from letsencrypt and covers xxxxx.com as well as appx.xxxxx.com.
So it is really strange. Also the fact that the certificate works well when I access the meteor app directly as this:

https://appx.xxxxx.com:8011

Any help is much appreciated. I’ve struggled several days with this problem.

My apache config looks like this:

<VirtualHost *:443>
  ServerName appx.xxxxx.com
  ProxyRequests Off
  SSLEngine on
  SSLProxyEngine on
  SSLProxyVerify none
  SSLProxyCheckPeerCN off
  SSLProxyCheckPeerName off
  SSLProxyCheckPeerExpire off
  ProxyPreserveHost On
  SSLCertificateFile /etc/letsencrypt/live/xxxxx.com/cert.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/xxxxx.com/privkey.pem
  SSLCertificateChainFile /etc/letsencrypt/live/xxxxx.com/fullchain.pem
  <Proxy *>
  Order deny,allow
  Allow from all
  </Proxy>
  ProxyPass / https://appx.xxxxx.com:8011/
  ProxyPassReverse / https://appx.xxxxx.com:8011/
</VirtualHost>

I hired someone to help me as it was getting too complex.
The main problem seemed to be that the stud service was using 443 and had not been disabled.
I originally used mup to deploy the meteor app. mup uses stud for ssl.
Then I later to switched to mupx but didn’t stop stud (as otherwise suggested in the migration guide :expressionless: )
There were various other issues as well but this was the main one.